Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>close() close file</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 close()                 Close File

 #include <io.h>                         Required for declarations only

 int        close(handle);
 int        handle;                      Handle referring to open file

    close() closes the file associated with a file handle, 'handle'
    obtained with a previous _creat(), creat(), creatnew(), creattemp(),
    dup(), dup2(), _open() or open() call.  If the file is a text file,
    close() does not add a Control-Z character to the end of the file.

    Returns:    0 if successful.  If an invalid file handle was given, -1
                is returned and 'errno' is set to EBADF (bad file
                number).

   -------------------------------- Example ---------------------------------

    This example opens a file for reading and writing, then closes it.

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

           int fhndl;

           main()
           {
               fhndl = open("data",O_RDWR);
                .
                .
                .
               close(fhndl);
           }



See Also: creat() dup() dup2() open() unlink()

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