在C中创建目录 [英] Create a directory in C

查看:80
本文介绍了在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


这篇关于在C中创建目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆