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");
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster