Unicode导致CreateProcess失败

CreateProcess的第二个参数必须是可写缓冲区,因此用常量字符串是不对的:
STARTUPINFO si;
memset(&si, 0, sizeof(STARTUPINFO));
si.cb
= sizeof(STARTUPINFO);
si.dwFlags
= STARTF_USESHOWWINDOW;
si.wShowWindow
= SW_SHOW;
PROCESS_INFORMATION pi;
TCHAR cmd[MAX_PATH]
= _T("e://abc.exe");
CreateProcess(NULL,cmd,NULL,NULL,FALSE,
0,NULL,NULL,&si,&pi);

 

原文:http://topic.csdn.net/u/20091215/00/56822dbe-8595-4e8b-8271-80510b564a45.html

你可能感兴趣的:(cmd,null,Path)