string Srcpath = "D:\\Desktop\\dddd"; if ((_access(Srcpath.c_str(), 0)) != 0) // 判断Srcpath路径下的文件夹dddd是否存在,如果不存在,自动新建文件夹dddd { string dd = "md " + Srcpath; system(dd.c_str()); }

本文提供了一个使用C++代码来检查并创建指定路径下文件夹的简单示例。通过string和system函数结合,实现了对文件夹存在的判断及自动创建功能。
string Srcpath = "D:\\Desktop\\dddd"; if ((_access(Srcpath.c_str(), 0)) != 0) // 判断Srcpath路径下的文件夹dddd是否存在,如果不存在,自动新建文件夹dddd { string dd = "md " + Srcpath; system(dd.c_str()); }

转载于:https://www.cnblogs.com/qiushui127/p/7147405.html
730
1471

被折叠的 条评论
为什么被折叠?