http://blog.csdn.net/u012005313/article/details/50688257
#include#include #include #include #include #include #include using namespace std;int main(){ string cursubdirname = "123"; if (access(cursubdirname.c_str(), 0) == -1) { cout << cursubdirname << " is not existing" << endl; cout << "now make it" << endl;#ifdef WIN32 int flag = _mkdir(cursubdirname.c_str());#endif #ifdef linux int flag = mkdir(dir.c_str(), 0777);#endif if (flag == 0) { cout << "make successfully" << endl; } else { cout << "make errorly" << endl; } }}