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 6.0 - <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 stdio.h for ANSI compatibility

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

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

    Returns:    Zero if the file is successfully deleted.  On error, -1
                is returned and 'errno' (defined in <stdlib.h>) is set
                to:

                    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