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

 #include   <dir.h>                      Required for declarations only

 int        rmdir(pathname);
 const char *pathname;                   Name of Path name to be removed

    rmdir() removes a directory specified by 'pathname'. A directory
    cannot be removed if it is either the root directory or the current
    directory, of if it contains any files or subdirectories.

       Returns:     0, if successful; -1 is returned on error and 'errno'
                    (defined in <errno.h>) is set to:

                     EACCES     Permission denied
                     ENOENT     Path name not found

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

    The following statements delete a directory and prints a message.

           #include <dir.h>

           int result1;

           main()
           {
                 if ((result1 = rmdir("/tstmkd")) < 0)
                     printf("error removing directory");
                 else
                     printf("tstmkd deleted");
           }


See Also: chdir() mkdir()

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