Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fopen, fseek, fwrite for large files
Message
From
13/08/2007 22:20:40
 
 
To
13/08/2007 21:22:39
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01247944
Message ID:
01247949
Views:
19
Hi Carlos.

I'm not sure what the problem is as Set Decimals does not alter how values are calculated, only how they are displayed.

The two values you are calculating look like thy should be the correct values to pass to the API.
You could try the following to calculate the low integer if you want, but I'd expect it to produce the same results as what you already have.
cpL=lDistanceToMove % 2^32

Ian Simcock.


>I am trying to code replacement functions to FOPEN, FCLOSE, FSEEK, etc, that work with large files (>4gb)
>
>I have found this example:
>
>Calling the Windows APIs for Large Files
>http://blogs.msdn.com/calvin_hsia/comments/398749.aspx
>
>The problem is that I want to use SetFilePointerEx, I understand that I have to "split" the liDistanceToMove LARGE_INTEGER parameter into two 4 byte numbers, the problem is this code:
>
>cpH=INT(lDistanceToMove/2^32)
>cpL=lDistanceToMove - cpH * 2^32
>
>This depends on the SET DECIMALS setting, and at the default, for example 4294967295 / 2^32 yields 1, so I have to do:
>
>m.lnOldDecimals = Set("Decimals")
>Set Decimals To 18
>m.lnHigh = Int(lDistanceToMove / 2^32)
>Set Decimals To (m.lnOldDecimals)
>
>I bet there must be a more elegant way to do this, I tried for example:
>
>Bitrshift(lDistanceToMove, 32)
>
>But of course it does not work.
>
>Carlos Alloatti
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform