c++创建多级目录

本文使用的是windows 下的命令“md”

_access 所需头文件 io.h

示例如下:

string dir = "d:\\data\\1\\2\\3";
string commond = "md " + dir;         //md后面有空格
if (_access(dir.c_str(),0)==-1)   //判断目录是否存在 -1即表示不存在
{
    system(commond.c_str())           //创建目录
}

 
 

猜你喜欢

转载自blog.csdn.net/ywj541726330/article/details/80550658
今日推荐