#include <iostream> #include <fstream> #include <string> #include <sys/stat.h> #include <direct.h> void main() { struct _stat file_state; std::string dir="test_dir"; if ((_stat(dir.data(),&file_state) ==0)) { printf("exist"); } else { _mkdir(dir.data()); printf("crested at xxx"); } system("pause"); }