Win,linux 创建文件夹

来源:互联网 发布:时时彩的的网络女孩 编辑:程序博客网 时间:2024/06/06 19:53

网上搜索到的,原文忘了在哪里了,sorry


时间久了确实好多东西记不住

注:只能检查一层目录

//  static function check dir // Check only one layer#ifndef _CHECK_DIR_#define _CHECK_DIR_#ifdef WIN32  #include <io.h>#include <direct.h>  #endif  #ifdef linux   #include <unistd.h> #include <sys/types.h>  #include <sys/stat.h> #endif  static bool check_dir(const char* dir){if (_access(dir, 0) == -1){#ifdef WIN32  int flag = _mkdir(dir);#endif  #ifdef linux   int flag = mkdir(dir.c_str(), 0777);#endif  return (flag == 0);}return true;};#endif


0 0
原创粉丝点击