Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:docs:fapi:dosbufreset [2018/09/02 01:55] – created prokushev | en:docs:fapi:dosbufreset [2021/09/17 03:39] (current) – prokushev | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | {{logos:os2.gif? | + | {{page>en:templates:fapiint}} |
====== DosBufReset ====== | ====== DosBufReset ====== | ||
Line 5: | Line 5: | ||
This call flushes a requesting process' | This call flushes a requesting process' | ||
- | ==Syntax== | + | ===== Syntax |
- | | + | <code c> |
+ | DosBufReset (FileHandle) | ||
+ | </ | ||
- | ==Parameters== | + | ===== Parameters |
- | *FileHandle (HFILE) - input : File handle whose buffers are to be flushed. If FileHandle = 0xFFFFH, all of the process' | ||
- | ==Return Code== | + | *FileHandle ([[HFILE]]) - input : File handle whose buffers are to be flushed. If FileHandle = 0xFFFFH, all of the process' |
- | rc (USHORT) - return | + | |
+ | ===== Return Code ===== | ||
+ | |||
+ | rc ([[USHORT]]) - return | ||
| | ||
Return code descriptions are: | Return code descriptions are: | ||
Line 23: | Line 27: | ||
* 6 ERROR_INVALID_HANDLE | * 6 ERROR_INVALID_HANDLE | ||
- | ==Remarks== | + | ===== Remarks ===== |
Upon issuing DosBufReset for a file handle, the file's buffers are flushed to disk and its directory entry updated as if the file had been closed; however the file remains in an open state. | Upon issuing DosBufReset for a file handle, the file's buffers are flushed to disk and its directory entry updated as if the file had been closed; however the file remains in an open state. | ||
Line 29: | Line 34: | ||
Usage of this call to write out all files belonging to the requesting process should be administered with caution. When the files reside on removable media (diskettes), | Usage of this call to write out all files belonging to the requesting process should be administered with caution. When the files reside on removable media (diskettes), | ||
- | ===Named Pipe Considerations=== | + | ====Named Pipe Considerations==== |
Issuing DosBufReset for a named pipe performs an operation that is analogous to forcing the buffer cache to disk. The request blocks the calling process at one end of the pipe until all data it has written has been read at the other end of the pipe. | Issuing DosBufReset for a named pipe performs an operation that is analogous to forcing the buffer cache to disk. The request blocks the calling process at one end of the pipe until all data it has written has been read at the other end of the pipe. | ||
- | ==Example Code== | + | ===== Example Code ===== |
- | ===C Binding=== | + | |
- | #define INCL_DOSFILEMGR | + | ==== C Binding ==== |
- | + | ||
- | USHORT | + | |
- | + | ||
- | HFILE FileHandle; | + | |
- | + | ||
- | USHORT | + | |
+ | <code c> | ||
+ | |||
+ | #define INCL_DOSFILEMGR | ||
+ | |||
+ | USHORT | ||
+ | |||
+ | HFILE FileHandle; | ||
+ | |||
+ | USHORT | ||
+ | </ | ||
This example opens a file, writes some data to the file's buffer, then flushes the file's system buffer. | This example opens a file, writes some data to the file's buffer, then flushes the file's system buffer. | ||
+ | <code c> | ||
+ | #define INCL_DOSFILEMGR | ||
- | #define INCL_DOSFILEMGR | + | #define OPEN_FILE 0x01 |
- | + | #define CREATE_FILE 0x10 | |
- | | + | #define FILE_ARCHIVE 0x20 |
- | #define CREATE_FILE 0x10 | + | #define FILE_EXISTS OPEN_FILE |
- | #define FILE_ARCHIVE 0x20 | + | #define FILE_NOEXISTS CREATE_FILE |
- | #define FILE_EXISTS OPEN_FILE | + | #define DASD_FLAG 0 |
- | #define FILE_NOEXISTS CREATE_FILE | + | #define INHERIT 0x80 |
- | #define DASD_FLAG 0 | + | #define WRITE_THRU 0 |
- | #define INHERIT 0x80 | + | #define FAIL_FLAG 0 |
- | #define WRITE_THRU 0 | + | #define SHARE_FLAG 0x10 |
- | #define FAIL_FLAG 0 | + | #define ACCESS_FLAG 0x02 |
- | #define SHARE_FLAG 0x10 | + | |
- | #define ACCESS_FLAG 0x02 | + | |
- | + | ||
- | #define FILE_NAME " | + | |
- | #define FILE_SIZE 800L | + | |
- | #define FILE_ATTRIBUTE FILE_ARCHIVE | + | |
- | #define RESERVED 0L | + | |
- | + | ||
- | HFILE | + | |
- | USHORT | + | |
- | USHORT | + | |
- | PSZ | + | |
- | USHORT | + | |
- | + | ||
- | + | ||
- | Action = 2; | + | |
- | strcpy(FileData, | + | |
- | if(!DosOpen(FILE_NAME, | + | |
- | & | + | |
- | & | + | |
- | FILE_SIZE, | + | |
- | FILE_ATTRIBUTE, | + | |
- | FILE_EXISTS | FILE_NOEXISTS, | + | |
- | DASD_FLAG | INHERIT | /* Open mode of the file */ | + | |
- | WRITE_THRU | FAIL_FLAG | | + | |
- | SHARE_FLAG | ACCESS_FLAG, | + | |
- | RESERVED)) | + | |
- | if(!DosWrite(FileHandle, | + | |
- | | + | |
- | | + | |
- | & | + | |
- | rc = DosBufReset(FileHandle); | + | |
- | ===MASM Binding=== | + | #define FILE_NAME " |
+ | #define FILE_SIZE 800L | ||
+ | #define FILE_ATTRIBUTE FILE_ARCHIVE | ||
+ | #define RESERVED 0L | ||
- | EXTRN DosBufReset: | + | HFILE |
- | INCL_DOSFILEMGR | + | USHORT |
- | + | USHORT | |
- | PUSH | + | PSZ |
- | CALL | + | USHORT |
- | + | ||
+ | Action = 2; | ||
+ | strcpy(FileData, | ||
+ | if(!DosOpen(FILE_NAME, | ||
+ | & | ||
+ | & | ||
+ | FILE_SIZE, | ||
+ | FILE_ATTRIBUTE, | ||
+ | FILE_EXISTS | FILE_NOEXISTS, | ||
+ | DASD_FLAG | INHERIT | /* Open mode of the file */ | ||
+ | WRITE_THRU | FAIL_FLAG | | ||
+ | SHARE_FLAG | ACCESS_FLAG, | ||
+ | RESERVED)) | ||
+ | |||
+ | if(!DosWrite(FileHandle, | ||
+ | | ||
+ | | ||
+ | & | ||
+ | |||
+ | rc = DosBufReset(FileHandle); | ||
+ | </ | ||
+ | |||
+ | ==== MASM Binding ==== | ||
+ | |||
+ | <code asm> | ||
+ | EXTRN DosBufReset: | ||
+ | INCL_DOSFILEMGR | ||
+ | |||
+ | PUSH | ||
+ | CALL | ||
+ | </ | ||
Returns WORD | Returns WORD | ||
- | ====== Note ====== | + | ===== Note ===== |
Text based on [[http:// | Text based on [[http:// |