Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <io.h>
    int close( int handle );
    int _close( int handle );

Description:
    The close function closes a file at the operating system level.  The
    handle value is the file handle returned by a successful execution of
    one of the  creat,  dup,  dup2,  open or  sopen functions.

    The _close function is identical to close.  Use _close for ANSI/ISO
    naming conventions.

Returns:
    The close function returns zero if successful.  Otherwise, it returns -1
    and  errno is set to indicate the error.

Errors:
    When an error has occurred,  errno contains a value indicating the type
    of error that has been detected.

    Constant     Meaning

EBADF
    The handle argument is not a valid file handle.


Example:
    #include <fcntl.h>
    #include <io.h>

    void main()
      {
        int handle;

        handle = open( "file", O_RDONLY );
        if( handle != -1 ) {
          /* process file */
          close( handle );
        }
      }

Classification:
    close is POSIX 1003.1, _close is not POSIX

_close conforms to ANSI/ISO naming conventions

Systems:
     close - All, Netware

    _close - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32

See Also:
    creat, dup, dup2, open, sopen

See Also: dup2

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson