home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------------------------
- * filename - closea.cas
- *
- * function(s)
- * _close - close a file handle
- *--------------------------------------------------------------------------*/
-
- /*[]------------------------------------------------------------[]*/
- /*| |*/
- /*| Turbo C Run Time Library - Version 3.0 |*/
- /*| |*/
- /*| |*/
- /*| Copyright (c) 1987,1988,1990 by Borland International |*/
- /*| All Rights Reserved. |*/
- /*| |*/
- /*[]------------------------------------------------------------[]*/
-
-
- #pragma inline
- #include <io.h>
- #include <_io.h>
-
- /*--------------------------------------------------------------------------*
-
- Name _close - close a file handle
-
- Usage int _close(int handle);
-
- Prototype in io.h
-
- Description _close closes the file handle indicated by handle which is
- obtained from a _creat, creat, creatnew, creattemp, dup,
- dup2, _open or open call.
-
- Return value Upon successful completion, close returns 0 otherwise, a
- value of -1 is returned and, errno is set to
- EBADF Bad file number
-
- *---------------------------------------------------------------------------*/
- int _CType _close( register int fd )
- {
- asm mov ah, 3eh
- asm mov bx, fd
- asm int 21h
- asm jc _closeFailed
- _openfd [_BX] = ~0;
- return 0;
-
- _closeFailed:
- return __IOerror (_AX);
- }
-