🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #7370

Re: High order word of __int64

#7370
From: Ed Mulroy [TeamB]
Date: Sat, 12 Feb 2005 21:06
41 lines
1988 bytes
There are a couple of ways to do that.

These are just written to illustrate what I mean.  I have not run them 
through the compiler so beware of typos.

Use the LARGE_INTEGER type that the Windows header files supply.

  -----------------
__int64 FileSeek(HANDLE file_hand, __int64 new_pos)
  {
  LARGE_INTEGER li;

  li.QuadPart = new_pos;

  li.LowPart = SetFilePointer(file_hand, li.LowPart, &li.HighPart, 
FILE_BEGIN);
  return li.QuadPart;
  }
  -----------------

Use casts

__int64 FileSeek(HANDLE file_hand, __int64 new_pos)
  {
  long high_part = (long) (new_pos >> 32);
  DWORD low_part = (DWORD) new_pos;

  low_part = SetFilePointer(file_hand, low_part, &high_part, 
FILE_BEGIN);
  return (((__int64) high_part) << 32) | low_part;
  }
  -----------------

.  Ed

> Chris wrote in message
> news:420e55a3$1@newsgroups.borland.com...
>
> Can someone show me how to convert an __int64 into high and low 
> order words for use in SetFilePointer that uses the high order word 
> to support large files.
Technical Details
Message-ID: <420e701a$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <420e55a3$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,26f5011a53593fe2
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ed Mulroy [TeamB]" <dont_email_me@invalid.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <420e55a3$1@newsgroups.borland.com>
Subject: Re: High order word of __int64
Date: Sat, 12 Feb 2005 16:06:34 -0500
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 24.211.226.180
Message-ID: <420e701a$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1108242458 24.211.226.180 (12 Feb 2005 13:07:38 -0800)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail