[<<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 Path name to be removed

    rmdir() deletes the directory specified by 'pathname'. All files and
    subdirectories must first be deleted from the directory, and it
    cannot be the current working directory or the root directory.

    Returns:    A zero if the directory was successfully deleted, or -1
                on error. -1 causes 'errno' (defined in <stdlib.h>) to be
                set to:

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

  -------------------------------- 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()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson