How to create a directory?

S

sieg1974

Hi,

I'm using gcc on Linux, and looking for the command used to create a
directory. Does anyone know it?


Thanks

Andre
 
T

Tim Cambrant

sieg1974 said:
Hi,

I'm using gcc on Linux, and looking for the command used to create a
directory. Does anyone know it?


Thanks

Andre

This is off topic in this newsgroup. The ANSI C standard library doesn't
contain any function for creating directories. Try asking in
comp.unix.programmer or similar newsgroup.
 
K

Keith Thompson

cody said:
md or mkdir

[de-top-posted]

This is why it's best to ask questions like this in an appropriate
newsgroup. The regulars in a Linux newsgroup would know that there's
no "md" function or command. (It's an alias for "mkdir" in MS-DOS.)

The question itself isn't inherently off-topic, but the proper answer
is that there's no portable way to do it in C.
 
N

Nicola Mingotti

Hi,

I'm using gcc on Linux, and looking for the command used to create a
directory. Does anyone know it?

/* example */
#include<sys/stat.h>

int main(int argc,char **argv){
if (argc < 2) exit(1);
mkdir(argv[1],0777);
return 0;
}

try :
$>info libc
you will find A LOT of very usefull information .

Bye .
 
M

Malcolm

Your reply was valid for unix type systems only. In ANSI C there is no
standard way of creating directories.
Please don't give platform-specific information so that we can maintain
topicality on the group.
 
J

Jan Engelhardt

Nicola Mingotti said:
Your reply was valid for unix type systems only. In ANSI C there is no
standard way of creating directories.

mkdir(2)
CONFORMING TO
SVr4, POSIX, BSD, SYSV, X/OPEN.

If not ANSI C, then POSIX ;) which is quite a standard for me.
 
I

Irrwahn Grausewitz

Jan Engelhardt said:
mkdir(2)
CONFORMING TO
SVr4, POSIX, BSD, SYSV, X/OPEN.

If not ANSI C, then POSIX ;) which is quite a standard for me.

But is not discussed in comp.lang.c, sorry.

It would have been much better to tell the OP that his problem is not
addressed by the C standard(s) and therefore by c.l.c and then redirect
him to a NG where he is more likely to get profound information.

This has already been done, five and six days ago. What made you think
it's a good idea to place an off-topic reply right here, right now?

No offense intended. Regards,

Irrwahn
--
do not write: void main(...)
do not use gets()
do not cast the return value of malloc()
do not fflush( stdin )
read the c.l.c-faq: http://www.eskimo.com/~scs/C-faq/top.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,206
Latest member
Zenden

Latest Threads

Top