在C中创建目录
问题描述:
我是AIX上的usnigC.
我想在某个路径中创建目录.
在创建它之前,我想检查它是否已经存在.
我该如何在C语言中做这些事情?请帮帮我.
预先感谢.
Hi,
I am usnig C on AIX.
I want to create a directory in some path.
Before creating it, i want to check if it already exist or not.
How can I do these things in C? Please help me out.
Thanks in advance.
答
我认为您应该可以使用_mkdir和_access函数.
最多
I think you should be able to use the _mkdir and _access functions.
Max.
感谢您的答复,我在AIX上使用纯C代码.
我已经包含sys/types.h和sys/stat.h
sprintf(DocDir,%s/%s",< PATH OF DIR>,"DIRNAME");
mkdir(DocDir,0777);
但是收到错误消息,
文本"mkdir"是意外的.
请帮帮我.
Hi,
Thanks for reply I am using plain C code on AIX.
I had included sys/types.h and sys/stat.h
sprintf(DocDir,"%s/%s",<PATH OF DIR>,"DIRNAME");
mkdir(DocDir,0777);
But receiving error as,
the text "mkdir" is unexpected.
Please help me out.
您好,我发送了一些代码来创建新目录
只需添加按钮并设置点击事件,此代码
Hello I send some code for create new directory
just you add button and set it''s click event this code
if (System.IO.Directory.CreateDirectory("C:/Hello").Exists)
{
MessageBox.Show("AllReady Available");
}
else
{
System.IO.Directory.CreateDirectory("C:/Hello");
MessageBox.Show("Create Directory");
}
希望获得帮助
Hope For Help