system问题
system("C:\\windows\\system32\\notepad.exe test.cpp");
调用成功 system返回0
给C:\\windows\\system32\\notepad.exe加上双引号再调用
system("\"C:\\windows\\system32\\notepad.exe\" test.cpp");
调用失败 system返回非0
而在cmd下面,无论第一个命令还是第二个命令都能调用成功
有没有人碰上过这个问题,为什么会这样呢 要怎么解决?
不加引号调用system,如果可执行文件有空格就会出问题
加上引号则调用不成功,真郁闷~
换成winexec的话又无法通过返回值知道程序执行是否成功