..msdn Add comment W32 Constants Translate this page
Moves the file pointer of the specified file.|
BOOL WINAPI SetFilePointerEx(
DECLARE INTEGER SetFilePointerEx IN kernel32;
[in] A handle to the file. The file handle must have been created with the GENERIC_READ or GENERIC_WRITE access right.
[in] The number of bytes to move the file pointer.
[out, optional] A pointer to a variable to receive the new file pointer.
[in] The starting point for the file pointer move.
|If the function succeeds, the return value is nonzero.|
* creates new empty file
hFile = CreateFile("c:\testfile.txt",;
GENERIC_WRITE, FILE_SHARE_WRITE, 0,;
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0)
* creates 64K of "pending" space in the file
* warning: setting the 3rd parameter, which is 0, to 1
* means making the pending size 4Gb larger
= SetFilePointerEx(hFile, 0xffff, 0, NULL, FILE_BEGIN)
* effectively increases the size of the file and writes
* 5 more bytes at the end of the file
cBuffer="123" + CHR(13) + CHR(10)
= WriteFile(hFile, cBuffer, LEN(cBuffer), 0,0)
|Note that the number of parameters is different in C and VFP declarations for this function. |
My first intention was to declare the second parameter, liDistanceToMove, as STRING @, which is the pointer to string. This approach worked in similar situations before but failed in this particular case.
Calvin Hsia in his blog`s entry explains why this function must be declared in VFP with rather five input parameters versus four regular ones.
The long integer (8 bytes) input parameter liDistanceToMove is passed to this function as two separate input parameters of LONG type (4 bytes each).
|Word Index links for the SetFilePointerEx :|
|Translate this page:|
Visited in last 7 days: 16
|Created: ||2007-08-20 16:37:26|
|Modified: ||2007-08-20 17:51:44|