lpcwstr

cannot convert parameter 1 from 'char' to 'LPCWSTR'

≯℡__Kan透↙ 提交于 2019-11-27 12:04:51
I keep getting this error: cannot convert parameter 1 from 'char' to 'LPCWSTR' int main(int argc, char argv[]) { // open port for I/O HANDLE h = CreateFile(argv[1],GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL); if(h == INVALID_HANDLE_VALUE) { PrintError("E012_Failed to open port"); can someone help? It should be int main(int argc, char* argv[]) And HANDLE h = CreateFileA(argv[1],GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL); Go to the Properties for your Project and under Configuration Properties/General, change the Character Set to "Not Set". This way, the compiler will

cannot convert parameter 1 from 'char' to 'LPCWSTR'

核能气质少年 提交于 2019-11-26 15:53:54
问题 I keep getting this error: cannot convert parameter 1 from 'char' to 'LPCWSTR' int main(int argc, char argv[]) { // open port for I/O HANDLE h = CreateFile(argv[1],GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL); if(h == INVALID_HANDLE_VALUE) { PrintError("E012_Failed to open port"); can someone help? 回答1: It should be int main(int argc, char* argv[]) And HANDLE h = CreateFileA(argv[1],GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL); 回答2: Go to the Properties for your Project