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
2009-10-02 09:45:10
+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
2009-10-02 09:45:17
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
2009-10-02 13:35:32
Bah, sorry yeah. Fixed.
therefromhere
2009-10-02 14:10:31
+3
A:
Although not part of the standard library, most implementations do include mkdir():
#include <dir.h>
...
mkdir("directory");
Andre Miller
2009-10-02 09:48:01
Which system uses that header and that call? POSIX requires a different header (`<sys/stat.h>`) and a call with two arguments.
Jonathan Leffler
2009-10-02 13:33:33
You are correct, it might be C++ specific. I found the reference here: http://poli.cs.vsb.cz/c/help/dir0.htm
Andre Miller
2009-10-02 14:58:20
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
2009-10-02 09:53:48