Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C - <b>remove() delete a file</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
remove()                 Delete A File

 #include   <io.h>                       Required for declarations only
 #include   <stdio.h>                    Use either io.h or stdio.h

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

    remove() deletes the file specified by 'pathname'.

    Returns:    Zero if the file is successfully deleted; or -1 if an
                error occurs. On error, 'errno' (defined in <stdlib.h>)
                is set to either

                    EACCES      'pathname' is a directory or read only
                                file; or
                    ENOENT      file name or path name not found.

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

    This example removes a file and prints a message.

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

         main()
         {
               int rslt;

               if ((rslt = remove("c:\auto\invoice.dat")) == 0)
                  printf("file deleted");
               else
                  printf("can't delete file");
         }

See Also: close() unlink()

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