Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - close http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   close

   Usage
   #include <io.h>
   int close(int fd);

   Description
   Closes  file  associated with file descriptor handle fd,  freeing  the
   file descriptor for use by another file. close does not write a Ctrl-Z
   character at the end of the file.

   Example
   #include <io.h>
   #include <dos.h>
   #include <stdio.h>
   main()
   {
   int fd,result;
        fd = open("CON",O_RDONLY);
        if(fd < 0 )
        {
             fprintf(stderr,"Can't open CON\n");
             abort();
        }
        result = close(fd);
        printf("Result code from close is %d\n",result);
   }

   Return Value
   close returns 0 if successful, or -1 and errno is set.


See Also: open unlink

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