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>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   <dir.h>                      Required for declarations only

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

    mkdir() creates a new directory specified by 'pathname'.

       Returns:     0, if successful; -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 at a time can be created. This
                    means 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 on the C: drive.

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

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

           #include <dir.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