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>unlink() delete a file</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 unlink()                Delete a File

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

 int        unlink(pathname);
 char       *pathname;                   Path name of file to be removed

    unlink() deletes the file specified by 'pathname', as long as the
    file is not read-only.

    Returns:    0, if successful.  On error, -1 is returned and 'errno'
                is set to one of the following:

                    EACCES    Path name specifies a directory or a
                              read-only file
                    ENOENT    File name or path name not found.

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

    The following statements attempt to delete a file and print an
    appropriate message.

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

           int result;

           main()
           {
               result = unlink("info.bak");
               if (result == -1)
                  perror("couldn't delete backup file");
               else
                  printf("backup file deleted");
           }


See Also: close()

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