Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:docs:fapi:dosclose [2018/08/26 13:49] – prokushev | en:docs:fapi:dosclose [2021/12/05 06:37] (current) – prokushev | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{logos:os2.gif? | + | {{page>en:templates:fapiint}} |
| ====== DosClose ====== | ====== DosClose ====== | ||
| This call closes a handle to a file, pipe, or device. | This call closes a handle to a file, pipe, or device. | ||
| - | ==Syntax== | + | ===== Syntax |
| - | | + | |
| + | <code c> | ||
| + | DosClose (FileHandle) | ||
| + | </ | ||
| + | |||
| + | ===== Parameters ===== | ||
| + | |||
| + | |||
| + | * FileHandle ([[HFILE]]) - input : Handle returned by a previous [[DosOpen]], | ||
| + | |||
| + | ===== Return Code ===== | ||
| - | ==Parameters== | + | rc ([[USHORT]]) - return |
| - | ; | + | |
| - | ==Return Code== | ||
| - | rc (USHORT) - return | ||
| Return code descriptions are: | Return code descriptions are: | ||
| - | * 0 NO_ERROR | ||
| - | * 2 ERROR_FILE_NOT_FOUND | ||
| - | * 5 ERROR_ACCESS_DENIED | ||
| - | * 6 ERROR_INVALID_HANDLE | ||
| - | ==Remarks== | + | * 0 NO_ERROR |
| + | * 2 ERROR_FILE_NOT_FOUND | ||
| + | * 5 ERROR_ACCESS_DENIED | ||
| + | * 6 ERROR_INVALID_HANDLE | ||
| + | |||
| + | ===== Remarks ===== | ||
| + | |||
| Issuing DosClose with the handle to a file closes a handle to a file, pipe, or device. | Issuing DosClose with the handle to a file closes a handle to a file, pipe, or device. | ||
| - | If one or more additional handles to a file have been created with DosDupHandle, | + | If one or more additional handles to a file have been created with [[DosDupHandle]], the directory is not updated and all internal buffers are not written to the medium until DosClose has been issued for the duplicated handles. |
| Closing a handle to a device causes the device to be notified of the close, if appropriate. | Closing a handle to a device causes the device to be notified of the close, if appropriate. | ||
| - | ===Named Pipe Considerations=== | + | ==== Named Pipe Considerations ==== |
| DosClose closes a named pipe by handle. When all handles referencing one end of a pipe are closed, the pipe is considered broken. | DosClose closes a named pipe by handle. When all handles referencing one end of a pipe are closed, the pipe is considered broken. | ||
| Line 32: | Line 45: | ||
| If the server end closes when the pipe is already broken, it is deallocated immediately; | If the server end closes when the pipe is already broken, it is deallocated immediately; | ||
| - | ==Example Code== | + | ===== Example Code ===== |
| - | ===C Binding=== | + | |
| - | < | + | |
| - | #define INCL_DOSFILEMGR | + | |
| - | USHORT | + | ==== C Binding ==== |
| + | |||
| + | <code c> | ||
| + | #define INCL_DOSFILEMGR | ||
| + | |||
| + | | ||
| + | |||
| + | HFILE FileHandle; | ||
| + | USHORT | ||
| + | </ | ||
| - | HFILE FileHandle; | ||
| - | USHORT | ||
| - | </ | ||
| This example opens a file, then closes it. | This example opens a file, then closes it. | ||
| - | <PRE> | + | <code c> |
| - | #define INCL_DOSFILEMGR | + | #define INCL_DOSFILEMGR |
| - | + | ||
| - | #define OPEN_FILE 0x01 | + | #define OPEN_FILE 0x01 |
| - | #define CREATE_FILE 0x10 | + | #define CREATE_FILE 0x10 |
| - | #define FILE_ARCHIVE 0x20 | + | #define FILE_ARCHIVE 0x20 |
| - | #define FILE_EXISTS OPEN_FILE | + | #define FILE_EXISTS OPEN_FILE |
| - | #define FILE_NOEXISTS CREATE_FILE | + | #define FILE_NOEXISTS CREATE_FILE |
| - | #define DASD_FLAG 0 | + | #define DASD_FLAG 0 |
| - | #define INHERIT 0x80 | + | #define INHERIT 0x80 |
| - | #define WRITE_THRU 0 | + | #define WRITE_THRU 0 |
| - | #define FAIL_FLAG 0 | + | #define FAIL_FLAG 0 |
| - | #define SHARE_FLAG 0x10 | + | #define SHARE_FLAG 0x10 |
| - | #define ACCESS_FLAG 0x02 | + | #define ACCESS_FLAG 0x02 |
| - | + | ||
| - | #define FILE_NAME " | + | #define FILE_NAME " |
| - | #define FILE_SIZE 800L | + | #define FILE_SIZE 800L |
| - | #define FILE_ATTRIBUTE FILE_ARCHIVE | + | #define FILE_ATTRIBUTE FILE_ARCHIVE |
| - | #define RESERVED 0L | + | #define RESERVED 0L |
| - | + | ||
| - | HFILE | + | HFILE |
| - | USHORT | + | USHORT |
| - | USHORT | + | USHORT |
| - | PSZ | + | PSZ |
| - | USHORT | + | USHORT |
| | | ||
| Line 82: | Line 98: | ||
| RESERVED)) | RESERVED)) | ||
| rc = DosClose(FileHandle); | rc = DosClose(FileHandle); | ||
| - | </PRE> | + | </code> |
| - | ===MASM Binding=== | + | ==== MASM Binding ==== |
| - | < | + | |
| - | EXTRN DosClose: | + | |
| - | INCL_DOSFILEMGR | + | |
| - | PUSH | + | <code asm> |
| - | CALL | + | EXTRN DosClose: |
| + | INCL_DOSFILEMGR | ||
| + | |||
| + | | ||
| + | CALL | ||
| + | </ | ||
| Returns WORD | Returns WORD | ||
| - | </ | ||
| + | ===== Note ===== | ||
| + | |||
| + | Text based on [[http:// | ||
| {{page> | {{page> | ||
| - | ====== Note ====== | ||
| - | |||
| - | Text based on [[http:// | ||




