Which function should I use to output text to the \"Output\" window in Visual Studio?
I tried printf()
but it doesn\'t show up.
If this is for debug output then OutputDebugString is what you want. A useful macro :
#define DBOUT( s ) \
{ \
std::ostringstream os_; \
os_ << s; \
OutputDebugString( os_.str().c_str() ); \
}
This allows you to say things like:
DBOUT( "The value of x is " << x );
You can extend this using the __LINE__
and __FILE__
macros to give even more information.
For those in Windows and wide character land:
#include
#include
#include
#define DBOUT( s ) \
{ \
std::wostringstream os_; \
os_ << s; \
OutputDebugStringW( os_.str().c_str() ); \
}