Which function should I use to output text to the \"Output\" window in Visual Studio?
I tried printf()
but it doesn\'t show up.
Useful tip - if you use __FILE__
and __LINE__
then format your debug as:
"file(line): Your output here"
then when you click on that line in the output window Visual Studio will jump directly to that line of code. An example:
#include
#include
#include
void DBOut(const char *file, const int line, const WCHAR *s)
{
std::wostringstream os_;
os_ << file << "(" << line << "): ";
os_ << s;
OutputDebugStringW(os_.str().c_str());
}
#define DBOUT(s) DBOut(__FILE__, __LINE__, s)
I wrote a blog post about this so I always knew where I could look it up: https://windowscecleaner.blogspot.co.nz/2013/04/debug-output-tricks-for-visual-studio.html