设为首页 加入收藏

TOP

C++创建多级目录代码教程
2017-10-29 06:07:14 】 浏览:268
Tags:创建 多级 目录 代码 教程

C++创建多级目录代码教程 #include

#include

#include

#include

using std::string;

void CreateMultiDir(const string& strPath)

{

string strTmpPath(strPath);

if (strTmpPath.find_last_of("\\") != strTmpPath.length() - 1)

{

strTmpPath += "\\";

}

int nPrePos = 0;

int nCurrPos = 0;

while (nCurrPos = strTmpPath.find_first_of("\\", nCurrPos), nCurrPos != -1)

{

while (nCurrPos != nPrePos)

{

CreateDirectory((CA2W)strTmpPath.substr(0, ++nCurrPos).c_str(), NULL);

nPrePos = nCurrPos;

}

}

}

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇C++多继承的类型转换中遇到的问题.. 下一篇c++用结构和类编程分别实现复数加..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目