Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <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 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()

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