Skip to content

Instantly share code, notes, and snippets.

@kumarchandresh
Created December 1, 2021 23:46
Show Gist options
  • Select an option

  • Save kumarchandresh/474941e4242e11dd61b9947cd2a27335 to your computer and use it in GitHub Desktop.

Select an option

Save kumarchandresh/474941e4242e11dd61b9947cd2a27335 to your computer and use it in GitHub Desktop.
Output to console in win32 app
// printf and cout will work as usual
FILE* fp;
AllocConsole();
freopen_s(&fp, "CONIN$", "r", stdin);
freopen_s(&fp, "CONOUT$", "w", stdout);
freopen_s(&fp, "CONOUT$", "w", stderr);
// Source: https://stackoverflow.com/a/19406695/5887576
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment