tags:

views:

160

answers:

5

Help appreciated. Couldn't find any mention of this in "the book" (k&r).

+1  A: 

By calling the mkdir() function. That links to the manual page online. To get that page on your (Linux) machine, enter in a terminal:

$ man 2 mkdir

The '2' is important, and is called the manual page section number. Since you want help for the C function "mkdir", as opposed to the command-line command "mkdir", you need to specify the section as otherwise you will get the command by default.

unwind
+2  A: 

On Linux, you can use the POSIX mkdir().

For documentation, click that link or try man 2 mkdir from the command line.

therefromhere
As the chosen answer notes, 'man mkdir' will tell you about the mkdir command, not the system call. Use either 'man 2 mkdir' or 'man -s 2 mkdir', depending on your 'man' command.
Jonathan Leffler
Bah, sorry yeah. Fixed.
therefromhere
A: 

mkdir

catwalk
+3  A: 

Although not part of the standard library, most implementations do include mkdir():

#include <dir.h>
...
mkdir("directory");
Andre Miller
Which system uses that header and that call? POSIX requires a different header (`<sys/stat.h>`) and a call with two arguments.
Jonathan Leffler
You are correct, it might be C++ specific. I found the reference here: http://poli.cs.vsb.cz/c/help/dir0.htm
Andre Miller
A: 
NAME
   mkdir - create a directory

SYNOPSIS
   #include <sys/stat.h>
   #include <sys/types.h>

   int mkdir(const char *pathname, mode_t mode);
CONFORMING TO
   SVr4, BSD, POSIX.1-2001.
Senthil Kumaran