创建文件目录C++ windows

#include <iostream>
#include <Windows.h>
int main(){
	char file[] = "E:\C1\ch";
	bool flag =  CreateDirectory(file,NULL);
	DWORD err = GetLastError();
	std::cout<<"flag: "<<flag<<std::endl;
	std::cout<<"err: "<<err<<std::endl;
	return 0;
}

这段代码编译时出现错误:cannot convert parameter 1 from 'char [15]' to 'LPCWSTR;

解决办法,Alt+F7;

image

修改:image

为:image

问题解决!

原文地址:https://www.cnblogs.com/nimo299/p/3571700.html