Archived

This topic is now archived and is closed to further replies.

CamelFly

Debug output

Recommended Posts

I know this is a simple question but still: how do you print things to the debug window in VC++6? I mean that little thing that displays compile info and such. I want to print things to it like i do to the console... thanks a lot! [Insert cool signature here]

Share this post


Link to post
Share on other sites
Is there a way to get a stream to the window so i can use the convinient stream operators ( << >> )?

Since it is mostly numbers i want to print it is a little akward to use itoa and such all the time.. is there a better way?

[Insert cool signature here]

Share this post


Link to post
Share on other sites
I don't get any debug output from OutputDebugString...

edited:

Ooops.. need to run program in debug mode sorry. i used ctrl-f5. should have used just f5. (though i really dont know what the difference is :-) )

[Insert cool signature here]

Edited by - CamelFly on February 8, 2002 11:22:54 AM

Share this post


Link to post
Share on other sites
To clarify some more perhaps

i want to do something like:

debugwindow << "really " << fancy << " debugging;

. iS this possible without me writing a subclass of ostream?

[Insert cool signature here]

Share this post


Link to post
Share on other sites
quote:
Original post by CamelFly
Is there a way to get a stream to the window so i can use the convinient stream operators ( << >> )?



Yeah, create a WindowConsoleBuf class derived from streambuf which uses OutputDebugString to output the data. You can redirect cout to that streambuf or create a while new ostream that uses your new streambuf class.

Search Google or the MSDN Library on how to derive from streambuf.


- Houdini


Edited by - Houdini on February 8, 2002 12:21:47 PM

Share this post


Link to post
Share on other sites
quote:
Original post by CamelFly
Might it be possible for me to see an example of this. I find stl io classes a wee bit confusing



Sigh, that's why I gave the links to Google and the MSDN Library. There are a ton of articles out there that explain this if you'd take the time to look.

I went to Google and searched for "derive from streambuf" and the very first link they returned was a tutorial on how to derive from streambuf to print to the debug window.


- Houdini


Edited by - Houdini on February 8, 2002 1:36:11 PM

Share this post


Link to post
Share on other sites