Re: read file > 2 GB
- From: kpg <no@xxxxxxxx>
- Date: Thu, 18 Jan 2007 13:35:36 -0800
Bob O`Bob <filterbob@xxxxxxxxxxxxxxx> wrote in
news:upMnK4zOHHA.4992@xxxxxxxxxxxxxxxxxxxx:
kpg wrote:
hi all,
I need to read a binary file > 2GB. (17GB in this case)
So I'm trying to use the setfilepointer API, which
accepts 64 bit integers.
I could write a function to take my large offset and split it into
high/low 32 bit numbers, but for a quick test I thought I would just
loop (offset/max_long) number of times, moving the file pointer from
the current location each time. (max_long = 2^31) than finally moving
the reaminder. This way I'm staying with 32 bit numbers, and just
pass a null as the high order long (per the documentation).
Well when I pass max_long to the SetFilePointer routine it complains
about overflow, so I'm sure I'm messing up on some of the finer
points of api usage.
Anyone got any large file vb6 api (or non-api) references?
thanks
kpg
the number you're calling "max_long" is off by 1.
the actual upper limit is /well-specified in the help files as/
"2,147,483,647" which, you will note, is NOT AN EVEN NUMBER.
Bob
OK, 2^31 on my calculator is 2147483647 (oddly enough, um, pun intended)
....but you are quite right, it should be even!
Well, as it turns out to ensure accuracy I did not type in the number, I
just did a ? 2^31 in the immediate window and I got 2147483648, which I
dutyfully pasted without any further thought.
Good call, Bob,
Course, what I was really fishing for was an API example if someone had
one handy - but I expect I'm on my way now.
It's been that kind of a day. Now I have to live with the fact that my
calculator can't do math any better than I can.
kpg
.
- Follow-Ups:
- Re: read file > 2 GB
- From: Tony Proctor
- Re: read file > 2 GB
- From: AMDRIT
- Re: read file > 2 GB
- References:
- read file > 2 GB
- From: kpg
- Re: read file > 2 GB
- From: Bob O`Bob
- read file > 2 GB
- Prev by Date: Re: VB 6 Support
- Next by Date: Re: Invalid procedure call or argument - Dir function
- Previous by thread: Re: read file > 2 GB
- Next by thread: Re: read file > 2 GB
- Index(es):
Relevant Pages
|