windows 系统下,使用标准 C 语言函数来判定文件或目录是否存在
#include <io.h>
#include <windows.h>
if (_access(path, 0) != 0) // Mode: 0 是否存在 2 写入 4 读取 6 读写
{
if (!CreateDirectoryA(path, NULL))
{
printf("创建目录失败!\n");
return 1;
}
}
windows 系统下,使用标准 C 语言函数来判定文件或目录是否存在
#include <io.h>
#include <windows.h>
if (_access(path, 0) != 0) // Mode: 0 是否存在 2 写入 4 读取 6 读写
{
if (!CreateDirectoryA(path, NULL))
{
printf("创建目录失败!\n");
return 1;
}
}