I am using CreateProcess to execute a command line call
I want to redirect the StdOut and StdErr to a text file
All the examples I can find show how to send StdOut to a pipe, by using CreatePipe and assigning the handle to STARTUPINFO.hStdOut
I dont want to do this as the output is huge and can exceed max buffer size...
I tried to use CreateFile to give me a handle to a new file, and gave this to both hStdOut and hStdErr of my STARTUPINFO, but the file always comes up empty!
Any ideas how to redirect CreateProcess StdOut and StdErr to a new text file!
All code on this page is protected by an SEP field!!!
Re: CreateProcess and redirect StdOut to a text file
Sorry, can't give you a code right now, but you need to use the CreatePipe function to create, erm, pipes, then pass the STARTF_USESTDHANDLES flag to dwFlags in the STARTINFO structure, as well as setting the hStdOutput and hStdError to the pipes you created with CreatePipe. The pipes can then be read with ReadFile.
Sorry, I can't give you a code right now, but I hope that helped.