0

我在我的代码中执行一个 .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

如何让响应的字符串在我的进一步代码中使用?

4

1 回答 1

2

See these Microsoft samples on how to capture the standard output and error via pipes:

于 2013-09-05T16:14:39.507 回答