home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / CLIB2.ZIP / CLOSEA.CAS < prev    next >
Encoding:
Text File  |  1990-06-07  |  1.8 KB  |  52 lines

  1. /*---------------------------------------------------------------------------
  2.  * filename - closea.cas
  3.  *
  4.  * function(s)
  5.  *        _close - close a file handle
  6.  *--------------------------------------------------------------------------*/
  7.  
  8. /*[]------------------------------------------------------------[]*/
  9. /*|                                                              |*/
  10. /*|     Turbo C Run Time Library - Version 3.0                   |*/
  11. /*|                                                              |*/
  12. /*|                                                              |*/
  13. /*|     Copyright (c) 1987,1988,1990 by Borland International    |*/
  14. /*|     All Rights Reserved.                                     |*/
  15. /*|                                                              |*/
  16. /*[]------------------------------------------------------------[]*/
  17.  
  18.  
  19. #pragma inline
  20. #include <io.h>
  21. #include <_io.h>
  22.  
  23. /*--------------------------------------------------------------------------*
  24.  
  25. Name            _close - close a file handle
  26.  
  27. Usage           int _close(int handle);
  28.  
  29. Prototype in    io.h
  30.  
  31. Description     _close closes the  file handle indicated by handle  which is
  32.                 obtained  from a  _creat, creat,  creatnew, creattemp, dup,
  33.                 dup2, _open or open call.
  34.  
  35. Return value    Upon  successful completion,  close returns  0 otherwise,  a
  36.                 value of  -1 is returned  and, errno is  set to
  37.                         EBADF   Bad file number
  38.  
  39. *---------------------------------------------------------------------------*/
  40. int _CType _close( register int fd )
  41. {
  42. asm     mov     ah, 3eh
  43. asm     mov     bx, fd
  44. asm     int     21h
  45. asm     jc      _closeFailed
  46.         _openfd [_BX] = ~0;
  47.         return 0;
  48.  
  49. _closeFailed:
  50.         return __IOerror (_AX);
  51. }
  52.