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++ 3.0r4 - <b>close</b> 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 (EOF)
   character at the end of the file.

Example 

   #include <io.h>
   #include <dos.h>
   #include <stdio.h>
   #include <stdlib.h>

   int main()
   {
   int fd,result;
       fd = open("temp",O_RDONLY);
       if(fd < 0 )
           {
               fprintf(stderr,"Can't open temp\n");
               abort();
           }
       result = close(fd);
       printf("Result code from close is %d\n",result);
       return EXIT_SUCCESS;
   }

Return Value

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

See Also

   open, unlink


See Also: open unlink

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