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

 #include   <direct.h>                   Required for declarations only

 int        rmdir(pathname);
 char       *pathname;                   Name of directory to be removed

    rmdir() removes the directory designated by 'pathname'.

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

                    EACCES     pathname is not a directory; or directory
                               is not empty; or the directory is the
                               current directory or the root directory.
                    ENOENT     pathname not found.

     Note:     The directory cannot be deleted if it is the current or root
 directory or if it contains any files or subdirectories that have not been
 deleted.

 Portability:   Applies to MS DOS only.

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

    The following statement removes a directory and prints a message

           #include <direct.h>

           int result1;

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


See Also: chdir() mkdir()

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