我在代码中执行.exe。像:
if( !CreateProcess( NULL, // No module name (use command line)
"sub.exe 2", // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi ) // Pointer to PROCESS_INFORMATION structure
)
sub.exe简单地将给定值乘以3.这样我就得到6
如何在我的进一步代码中获取响应的字符串?
答案 0 :(得分:2)
请参阅以下Microsoft示例,了解如何通过管道捕获标准输出和错误: