Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fopen, fseek, fwrite for large files
Message
From
13/08/2007 21:22:39
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Fopen, fseek, fwrite for large files
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01247944
Message ID:
01247944
Views:
174
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
Next
Reply
Map
View

Click here to load this message in the networking platform