Monday, August 25, 2014

Attaching a console in Win32

how to get a console in a few simple lines of code in windows:

DWORD pid;
pid = GetCurrentProcessId();
AllocConsole();
AttachConsole(pid);
freopen("CON", "w", stdout);
printf("hello, i am the console\n");

No comments: