Jump to content
  • Advertisement
Sign in to follow this  
SteveDeFacto

How to display text in the compiler output window?

This topic is 2775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I feel really stupid asking this since I have been programming for quite awhile but how do you display text in the compiler output window?

I always thought you just do this "std::cout << "Text to be displayed" << std::endl;" but when I do that nothing happens...

Share this post


Link to post
Share on other sites
Advertisement
As per diablos_blade's response, I have a wrapper that goes like this:


class DebugStream
{
private:
std::ostringstream o;

public:
~DebugStream(){ OutputDebugString(o.str().c_str()); }

template<class T> DebugStream &operator<<(const T &t){ o << t; return *this; }
};


which allows me to do things like:


void f()
{
int a=23;

DebugStream() << "a is equal to " << a << " at the moment\n";
}


Hope this is of use.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!