Help with CreateProcess()
Hi,
I have a problem using CreateProcess().
Let me show you the code first:
Code:
if(!CreateProcess(NULL, // No module name (use command line)
"POI.exe < data1.in > data1.out", // 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
){
printf( "CreateProcess failed (%d).\n", GetLastError() );
scanf("%d", &n);
return 0;
}
(Obviously I copied the code from MSDN and only modified a little :P)
I executed it, and it was sucessfully running POI.exe. However, the input and output are not redirected to data1.in and data1.out. Why is this happening? What's the solution to it?
Thanks in advance.