en:docs:fapi:dosclose

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
en:docs:fapi:dosclose [2018/09/02 02:50] prokusheven:docs:fapi:dosclose [2021/09/17 04:34] prokushev
Line 1: Line 1:
-{{logos:os2.gif?35x35}} {{logos:dos.gif?35x35}}+{{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 =====
  
-  DosClose (FileHandle)+<code c> 
 +DosClose (FileHandle) 
 +</code>
  
-==Parameters==+===== Parameters =====
  
-  * FileHandle (HFILE) - input : Handle returned by a previous DosOpen, DosMakeNmPipe, or DosMakePipe call. 
  
-==Return Code==+  * FileHandle ([[HFILE]]) - input : Handle returned by a previous [[DosOpen]], [[DosMakeNmPipe]], or [[DosMakePipe]] call.
  
-  rc (USHORT) - return+===== 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, the directory is not updated and all internal buffers are not written to the medium until DosClose has been issued for the duplicated handles.+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; otherwise, the pipe is not deallocated until the last client handle is closed. If the server end closes when the pipe is already broken, it is deallocated immediately; otherwise, the pipe is not deallocated until the last client handle is closed.
  
-==Example Code== +===== Example Code =====
-===C Binding===+
  
 +==== C Binding ====
 +
 +<code c>
   #define INCL_DOSFILEMGR   #define INCL_DOSFILEMGR
      
Line 49: Line 56:
   HFILE            FileHandle;    /* File handle */   HFILE            FileHandle;    /* File handle */
   USHORT           rc;            /* return code */   USHORT           rc;            /* return code */
 +</code>
  
 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 (must be zero) */                 RESERVED))               /* Reserved (must be zero) */
       rc = DosClose(FileHandle);         /* File Handle */       rc = DosClose(FileHandle);         /* File Handle */
 +</code>
  
-===MASM Binding===+==== MASM Binding ====
  
 +<code asm>
   EXTRN  DosClose:FAR   EXTRN  DosClose:FAR
   INCL_DOSFILEMGR     EQU 1   INCL_DOSFILEMGR     EQU 1
Line 98: Line 108:
   PUSH   WORD    FileHandle    ;File handle   PUSH   WORD    FileHandle    ;File handle
   CALL   DosClose   CALL   DosClose
-  +</code>   
 Returns WORD Returns WORD
  
-====== Note ======+===== Note =====
  
 Text based on [[http://www.edm2.com/index.php/DosClose_(FAPI)]] Text based on [[http://www.edm2.com/index.php/DosClose_(FAPI)]]