Re: read file > 2 GB

Tech-Archive recommends: Speed Up your PC by fixing your registry



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

.



Relevant Pages

  • Re: Making forms modal
    ... "In VB we had to code our own bugs. ... In dotnet we can inherit them." ... "Bob" wrote in message ... Is there and API? ...
    (microsoft.public.vb.controls)
  • Re: How to change Time from VB
    ... yet another time-wasting wrote: ... > Thanks, BOb. ... > My question was about api to change system clock as I did not want to use time ...
    (microsoft.public.vb.general.discussion)
  • Re: Write REG_EXPAND_SZ to Registry (PATH)
    ... > Hello Bob, ... For futrue reference you should always include the ... Declare statements for the API calls when you post since how you decalre ...
    (microsoft.public.vb.general.discussion)
  • Re: listbox scrollable?
    ... In addition to what Bob said, you can see some really nice API examples on http://vbnet.mvps.org/. ... Just run through a couple, and you'll start to notice which API calls are common, what ... naming conventions are being used, etc. It'll help you think of what you need to search for when you want to do something not on ...
    (microsoft.public.vb.general.discussion)
  • Re: read file > 2 GB
    ... moving the file pointer from ... points of api usage. ... calculator can't do math any better than I can. ...
    (microsoft.public.vb.general.discussion)