Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
en:docs:fapi:doschgfileptr [2018/08/26 13:38] – created prokushev | en:docs:fapi:doschgfileptr [2021/08/20 03:22] – prokushev | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{page> | ||
+ | ====== DosChgFilePtr ====== | ||
This call moves the read/write pointer in accordance with the type of move specified. | This call moves the read/write pointer in accordance with the type of move specified. | ||
==Syntax== | ==Syntax== | ||
- | | + | |
+ | | ||
==Parameters== | ==Parameters== | ||
- | ;FileHandle (HFILE) - input : Handle returned by a previous DosOpen call. | + | |
- | ; Distance (LONG) - input : The offset to move, in bytes. | + | * FileHandle ([[HFILE]]) - input : Handle returned by a previous DosOpen call. |
- | ; MoveType (USHORT) - input : Method of moving. Specifies a location in the file from where Distance to move the read/write pointer starts. Values and their meanings are: | + | |
- | ''' | + | |
- | | + | |
- | | + | ^ Value ^ Definition |
- | | + | | 0 | Beginning of the file. | |
- | ; NewPointer (PULONG) - output : Address of the new pointer location. | + | | 1 | Current location of the read/write pointer. |
+ | | 2 | End of the file. Use this method to determine a file's size. | | ||
+ | |||
+ | | ||
==Return Code== | ==Return Code== | ||
- | rc (USHORT) - return | + | |
+ | rc ([[USHORT]]) - return | ||
+ | | ||
Return code descriptions are: | Return code descriptions are: | ||
- | * 0 NO_ERROR | + | |
- | * 1 ERROR_INVALID_FUNCTION | + | |
- | * 6 ERROR_INVALID_HANDLE | + | * 1 ERROR_INVALID_FUNCTION |
+ | * 6 ERROR_INVALID_HANDLE | ||
==Remarks== | ==Remarks== | ||
Line 29: | Line 38: | ||
==Example Code== | ==Example Code== | ||
===C Binding=== | ===C Binding=== | ||
- | <PRE> | + | <code c> |
#define INCL_DOSFILEMGR | #define INCL_DOSFILEMGR | ||
Line 40: | Line 49: | ||
USHORT | USHORT | ||
- | </PRE> | + | </code> |
This example opens file test.dat, writes some data, and resets the file pointer to the beginning of the file. | This example opens file test.dat, writes some data, and resets the file pointer to the beginning of the file. | ||
- | <PRE> | + | <code c> |
#define INCL_DOSFILEMGR | #define INCL_DOSFILEMGR | ||
Line 61: | Line 70: | ||
#define FILE_ATTRIBUTE FILE_ARCHIVE | #define FILE_ATTRIBUTE FILE_ARCHIVE | ||
#define RESERVED 0L | #define RESERVED 0L | ||
+ | |||
HFILE | HFILE | ||
USHORT | USHORT | ||
Line 69: | Line 78: | ||
USHORT | USHORT | ||
- | Action = 2; | + | Action = 2; |
- | | + | strcpy(FileData, |
- | | + | if(!DosOpen(FILE_NAME, |
- | & | + | & |
- | & | + | & |
- | FILE_SIZE, | + | FILE_SIZE, |
- | FILE_ATTRIBUTE, | + | FILE_ATTRIBUTE, |
- | FILE_EXISTS | FILE_NOEXISTS, | + | FILE_EXISTS | FILE_NOEXISTS, |
- | DASD_FLAG | INHERIT | /* Open mode of the file */ | + | DASD_FLAG | INHERIT | /* Open mode of the file */ |
- | WRITE_THRU | FAIL_FLAG | | + | WRITE_THRU | FAIL_FLAG | |
- | SHARE_FLAG | ACCESS_FLAG, | + | SHARE_FLAG | ACCESS_FLAG, |
- | RESERVED)) | + | RESERVED)) |
- | if(!DosWrite(FileHandle, | + | if(!DosWrite(FileHandle, |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | MOVE_DIST, | + | MOVE_DIST, |
- | FILE_BEG, | + | FILE_BEG, |
- | & | + | & |
- | </PRE> | + | </code> |
===MASM Binding=== | ===MASM Binding=== | ||
- | <PRE> | + | <code asm> |
EXTRN DosChgFilePtr: | EXTRN DosChgFilePtr: | ||
INCL_DOSFILEMGR | INCL_DOSFILEMGR | ||
+ | | ||
PUSH | PUSH | ||
PUSH | PUSH | ||
Line 101: | Line 110: | ||
PUSH@ DWORD | PUSH@ DWORD | ||
CALL | CALL | ||
+ | </ | ||
Returns WORD | Returns WORD | ||
- | </ | ||
+ | |||
+ | == Note === | ||
+ | |||
+ | Text based on http:// | ||
+ | |||
+ | {{page> | ||