0

I have a Win32/C++ Command line program which displays message using "printf()" function. The program uses a 3rd party lib/dll which generates log message to the same console screen.

So is there a way to redirect all output messages to a PLACE and filter my own message to the console screen?

lonecatly
  • 85
  • 1
  • 6

1 Answers1

0

There are 3 main 'streams' that console application may have:

  1. Standard output
  2. Error output
  3. Log output

More info here

Now you can redirect one/all/multiple outputs to file, or any other stream like here

Then when you have file you can read and then filter to way that you like to see.

  • Does this mean I need to start my program in this way: example.exe > file.txt And then read the file content with another program? What if I need to display message in real-time? Or how can I redirect the output to file within my C++ console program? – lonecatly Mar 02 '16 at 09:31
  • You can run as: console.exe > file.txt or 'handle' http://stackoverflow.com/questions/3859276/get-console-handle http://stackoverflow.com/questions/191842/how-do-i-get-console-output-in-c-with-a-windows-program and http://stackoverflow.com/questions/2674237/using-a-handle-to-collect-output-from-createprocess –  Mar 02 '16 at 09:48