Given an existing Win32 GUI application, how can I see the messages it sends to stdout and stderr (file descriptors 1 and 2, cout and cerr, etc.)?
I cannot modify the application itself, and I know it simply calls C's printf
internally.
There are a few similar questions already (e.g. here or here), but the solutions suggest modifying the executable. One answer from 2009 to a similar question recommends using DebugView, but I couldn't get it to display the actual stdout of the process, only kernel and system messages.
For background, I have a GUI application that was compiled a few years ago. The author didn't really know how Windows apps work, and so he just compiled his Linux code into an EXE. His code follows the Unix convention of sending debug messages to stdout while displaying graphics at the same time. Now the app broke, and it seems the relevant into should be in stdout, but I can't view it. I don't have the sources so I can't recompile it.
A minimal example
// main.c
#include <stdio.h>
int main() // sic, not WinMain()
{
printf("%s\n", "Hello World!");
return 0;
}
compiled as
mingw main.c -mwindows
produces a.exe
. How can I launch a.exe, without modifying its source code, to be able to see the message?