#include "shlwapi.h"
#pragma comment(lib,"shlwapi.lib")
#pragma comment(lib,"shlwapi.lib")
String save_path = "D:\\Experiment\\Videos\\Frames\\";
LPCSTR pcstr = save_path.c_str(); // cv::String to LPCSTR
if (!PathIsDirectory(pcstr)) // 需要加入上面的头文件
{
::CreateDirectory(pcstr, NULL);
}
{
::CreateDirectory(pcstr, NULL);
}
注意:该函数不能连续创建两级目录,比如,目录”D:\\Experiment\\Videos\\“不存在,就不能直接创建 “D:\\Experiment\\Videos\\Frames\\”