c++ - I've created a new console in win32 window-only app, console is created but nothing gets print on it -
this code compiled -mwindows under gcc , there no winapi error message.
#include <windows.h> #include <stdio.h> int winapi winmain(hinstance hinstance, hinstance, lptstr, int ncmdshow) { allocconsole(); printf("%s\n", "sample text"); return 0; } result console black empty, no text, no error message.
use:
freopen("conout$", "wb", stdout); to reopen stdout after have created console. if plan on using input too, need:
freopen("conin$", "rb", stdin); and stderr may need opening too:
freopen("conout$", "wb", stderr);
Comments
Post a Comment