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

 #include   <direct.h>                   Required for declarations only

 int        mkdir(pathname);
 char       *pathname;                   Path name of new directory

    mkdir() creates the new directory 'pathname'.

    Returns:    Zero if new directory was created, or -1 on error. On
                error, 'errno' is set to:

                    EACCES     Directory not created. Specified name
                               already exists, or
                    ENOENT     Path name not found

      Notes:    Only one directory can be created at a time. This means
                that all but the last name of the path must specify an
                existing directory. That is, if the directory to be
                created is "c:\base\camp\out_post", then "\base\camp"
                must already exist.

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

    The following statements try to create a directory and print a
    message indicating whether or not the effort was successful.

         #include <direct.h>

         int result;

         main()
         {
             if ((result = mkdir("/tstmkd/new_one")) < 0)
                printf("error creating new directory");
             else
                 printf("new directory created");
         }

See Also: chdir() rmdir()

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