若文件名中有空格,只能得到文件路径空格前的字符串得不到整个路径字符串,请高手指点.有时间请看详细解释:
一个exe开启后,要通过另一个程序打开一个文件,打开另一个程序时传递文件名(包含路径)我是这样做的:
/////////主程序中//////////////////////////////////
char chCmdLine[256];
chCmdLine="应用程序路径"; strInfoPath = "文件路径";
strcat(chCmdLine,strInfoPath);
CreateProcess(NULL,chCmdLine,...)
////////////////////////////////////////////////
调试主程序中传进去是正确的,但是当"文件路径"中有空格时,子程序中只能得到"文件路径"空格前的字符串
从程序中是这样得到文件路径的:
////////////////////////////////////////////////
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
       cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing;
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
m_strInfoPath=cmdInfo.m_strFileName ;     //就这一句总是得到"文件路径"空格前的字符串,而不能得到整个字符串,请高手指点怎么才能得到字符串?