Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
en:docs:fapi:dosclose [2018/08/26 13:50] – prokushev | en:docs:fapi:dosclose [2018/09/02 02:50] – prokushev | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{logos: | {{logos: | ||
+ | |||
====== DosClose ====== | ====== DosClose ====== | ||
Line 5: | Line 6: | ||
==Syntax== | ==Syntax== | ||
- | | + | |
+ | | ||
==Parameters== | ==Parameters== | ||
- | ;FileHandle (HFILE) - input : Handle returned by a previous DosOpen, DosMakeNmPipe, | + | |
+ | * FileHandle (HFILE) - input : Handle returned by a previous DosOpen, DosMakeNmPipe, | ||
==Return Code== | ==Return Code== | ||
- | rc (USHORT) - return | + | |
+ | rc (USHORT) - return | ||
Return code descriptions are: | Return code descriptions are: | ||
- | * 0 NO_ERROR | + | |
- | * 2 ERROR_FILE_NOT_FOUND | + | |
- | * 5 ERROR_ACCESS_DENIED | + | * 2 ERROR_FILE_NOT_FOUND |
- | * 6 ERROR_INVALID_HANDLE | + | * 5 ERROR_ACCESS_DENIED |
+ | * 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. | ||
Line 26: | Line 33: | ||
===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 34: | Line 42: | ||
==Example Code== | ==Example Code== | ||
===C Binding=== | ===C Binding=== | ||
- | <PRE> | ||
- | #define INCL_DOSFILEMGR | ||
- | USHORT | + | #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> | ||
- | #define INCL_DOSFILEMGR | ||
- | #define OPEN_FILE 0x01 | + | #define INCL_DOSFILEMGR |
- | #define CREATE_FILE 0x10 | + | |
- | #define FILE_ARCHIVE 0x20 | + | |
- | #define FILE_EXISTS OPEN_FILE | + | #define CREATE_FILE 0x10 |
- | #define FILE_NOEXISTS CREATE_FILE | + | #define FILE_ARCHIVE 0x20 |
- | #define DASD_FLAG 0 | + | #define FILE_EXISTS OPEN_FILE |
- | #define INHERIT 0x80 | + | #define FILE_NOEXISTS CREATE_FILE |
- | #define WRITE_THRU 0 | + | #define DASD_FLAG 0 |
- | #define FAIL_FLAG 0 | + | #define INHERIT 0x80 |
- | #define SHARE_FLAG 0x10 | + | #define WRITE_THRU 0 |
- | #define ACCESS_FLAG 0x02 | + | #define FAIL_FLAG 0 |
- | + | #define SHARE_FLAG 0x10 | |
- | #define FILE_NAME " | + | #define ACCESS_FLAG 0x02 |
- | #define FILE_SIZE 800L | + | |
- | #define FILE_ATTRIBUTE FILE_ARCHIVE | + | #define FILE_NAME " |
- | #define RESERVED 0L | + | #define FILE_SIZE 800L |
- | + | #define FILE_ATTRIBUTE FILE_ARCHIVE | |
- | HFILE | + | #define RESERVED 0L |
- | USHORT | + | |
- | USHORT | + | HFILE |
- | PSZ | + | USHORT |
- | USHORT | + | USHORT |
+ | PSZ | ||
+ | USHORT | ||
| | ||
Line 82: | Line 90: | ||
RESERVED)) | RESERVED)) | ||
rc = DosClose(FileHandle); | rc = DosClose(FileHandle); | ||
- | </ | ||
===MASM Binding=== | ===MASM Binding=== | ||
- | <PRE> | ||
- | EXTRN DosClose: | ||
- | INCL_DOSFILEMGR | ||
- | |||
- | PUSH | ||
- | CALL | ||
+ | EXTRN DosClose: | ||
+ | INCL_DOSFILEMGR | ||
+ | | ||
+ | PUSH | ||
+ | CALL | ||
+ | | ||
Returns WORD | Returns WORD | ||
- | </ | ||
====== Note ====== | ====== Note ====== |