 |
SetFilePointer ..msdn Add comment W32 Constants Translate this page |
 |
 |
|
The SetFilePointer function moves the file pointer of an open file. |
 |
 |
| Code examples: |
 |
|
|
 |
 |
| Declaration: |
 |
 |
DWORD SetFilePointer(
HANDLE hFile, // handle to file
LONG lDistanceToMove, // bytes to move pointer
PLONG lpDistanceToMoveHigh, // bytes to move pointer
DWORD dwMoveMethod // starting point
);
|
 |
 |
 |
| FoxPro declaration: |
 |
 |
DECLARE INTEGER SetFilePointer IN kernel32;
INTEGER hFile,;
INTEGER lDistanceToMove,;
INTEGER lpDistanceToMoveHigh,;
INTEGER dwMoveMethod
|
 |
 |
 |
| Parameters: |
 |
hFile
[in] Handle to the file whose file pointer is to be moved.
lDistanceToMove
[in] Low-order 32 bits of a signed value that specifies the number of bytes to move the file pointer.
lpDistanceToMoveHigh
[in] Pointer to the high-order 32 bits of the signed 64-bit distance to move.
dwMoveMethod
[in] Starting point for the file pointer move -- a predefined value. |
 |
 |
| Return value: |
 |
| If the SetFilePointer function succeeds and lpDistanceToMoveHigh is NULL, the return value is the low-order DWORD of the new file pointer. If lpDistanceToMoveHigh is not NULL, the function returns the low order DWORD of the new file pointer, and puts the high-order DWORD of the new file pointer into the LONG pointed to by that parameter. |
 |
 |
| Usage: |
 |
#DEFINE OF_WRITE 1
#DEFINE FILE_BEGIN 0
STORE 0 TO lnSizeLo, lnSizeHi
lcOpenBuffer = Repli(Chr(0), 250)
phLocal = OpenFile(lcTargetFile, @lcOpenBuffer, OF_WRITE)
lnSizeLo = GetFileSize(phLocal, @lnSizeHi)
= SetFilePointer(phLocal, lnSizeLo, lnSizeHi, FILE_BEGIN)
* ...
= WriteFile(phLocal, @lcBuffer,;
lnBytesRead, @lnBytesWritten, 0)
* ...
= CloseHandle(phLocal)
|
 |
 |
| My comment: |
 |
This function stores the file pointer in two LONG values. To work with file pointers that are larger than a single LONG value, it is easier to use the SetFilePointerEx function.
|
 |
 |
| Word Index links for the SetFilePointer : |
 |
|
|
 |
 |
| Translate this page: |
 |
|
 |
 |
| • |
 |
| Created: | 2001-11-13 19:43:05 | | Modified: | 2007-08-20 16:36:20 | Visited in last 7 days: 21 |