I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
Index » Programming » Tutorials » C & C++ » Advanced »

Redirecting stdout

will\′s Photo
31 Oct 07, 10:25AM
Redirecting stdout
In graphical Windows applications, a handy trick for testing is to redirect stdio, stdout and stderr to a text based console window.

To achieve this is VS C++, simple put the following code somewhere near the top of your application. You need only do this once per thread:
AllocConsole(); 
freopen("conin$","r",stdin); 
freopen("conout$","w",stdout); 
freopen("conout$","w",stderr);
Currently you need to be logged in to leave a message.