1

Topic: Savings of an output of the console

I launch the console application with flag CREATE_NEW_PROCESS_GROUP. This console application launches other console application and its output happens in my console. How to me to save to save this output? I.e. how to make so, what the output of the second application would be and in my console, and in where  even for later processing?

2

Re: Savings of an output of the console

Hello, Aniskin, you wrote: A> I Launch the console application with flag CREATE_NEW_PROCESS_GROUP. This console application launches other console application and its output happens in my console. How to me to save to save this output? I.e. how to make so, what the output of the second application would be and in my console, and in where  even for later processing? Can, so The CreateProcess () API through the STARTUPINFO structure enables you to redirect the standard handles of a child console based process. If the dwFlags member is set to STARTF_USESTDHANDLES, then the following STARTUPINFO members specify the standard handles of the child console based process: HANDLE hStdInput - Standard input handle of the child process. HANDLE hStdOutput - Standard output handle of the child process. HANDLE hStdError - Standard error handle of the child process. You can set these handles to either a pipe handle, file handle, or any handle that can do synchronous reads and writes through the ReadFile () and WriteFile () API. The handles must be inheritable and the CreateProcess () API must specify that inheritable handles are to be inherited by the child process by specifying TRUE in the bInheritHandles parameter.

3

Re: Savings of an output of the console

Hello, RonWilson, you wrote: RW> can, so And how me thus to save an output of the second console in the first? After all it is necessary for me  an output, instead of to redirect it.

4

Re: Savings of an output of the console

Hello, Aniskin, you wrote: A> And how me thus to save an output of the second console in the first? After all it is necessary for me  an output, instead of to redirect it. Write that is possible through pipe, leaving alone stdout child: If the parent process creates an anonymous pipe it can use the write handle as the child process's stdout. The parent process would need to service the pipe; e.g. it might have a thread to read data from the pipe and write it to its own console.

5

Re: Savings of an output of the console

Hello, RonWilson, you wrote: RW> it is possible through pipe It turned out, thanks. Created , it I transfer child. In the console application created an additional flow which reads this  and deduces it in my console and in a file.