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/09/02 02:50] – 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 ====== | ||
| Line 5: | Line 5: | ||
| 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== | + | ===== Parameters |
| - | * FileHandle (HFILE) - input : Handle returned by a previous DosOpen, DosMakeNmPipe, | ||
| - | ==Return Code== | + | * FileHandle ([[HFILE]]) - input : Handle returned by a previous [[DosOpen]], |
| - | | + | ===== Return Code ===== |
| + | |||
| + | |||
| + | rc ([[USHORT]]) - return | ||
| Return code descriptions are: | Return code descriptions are: | ||
| Line 24: | Line 28: | ||
| * 6 ERROR_INVALID_HANDLE | * 6 ERROR_INVALID_HANDLE | ||
| - | ==Remarks== | + | ===== 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 40: | 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=== | + | |
| + | ==== C Binding ==== | ||
| + | |||
| + | <code c> | ||
| #define INCL_DOSFILEMGR | #define INCL_DOSFILEMGR | ||
| | | ||
| Line 49: | Line 56: | ||
| HFILE FileHandle; | HFILE FileHandle; | ||
| USHORT | USHORT | ||
| + | </ | ||
| This example opens a file, then closes it. | This example opens a file, then closes it. | ||
| + | <code c> | ||
| #define INCL_DOSFILEMGR | #define INCL_DOSFILEMGR | ||
| | | ||
| Line 90: | Line 98: | ||
| RESERVED)) | RESERVED)) | ||
| rc = DosClose(FileHandle); | rc = DosClose(FileHandle); | ||
| + | </ | ||
| - | ===MASM Binding=== | + | ==== MASM Binding |
| + | <code asm> | ||
| EXTRN DosClose: | EXTRN DosClose: | ||
| INCL_DOSFILEMGR | INCL_DOSFILEMGR | ||
| Line 98: | Line 108: | ||
| PUSH | PUSH | ||
| CALL | CALL | ||
| - | | + | </ |
| Returns WORD | Returns WORD | ||
| - | ====== Note ====== | + | ===== Note ===== |
| Text based on [[http:// | Text based on [[http:// | ||




