Debug output

Started by
7 comments, last by CamelFly 22 years, 3 months ago
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]
[Insert cool signature here]
Advertisement
OutputDebugString () is the function you''re looking for.
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]
[Insert cool signature here]
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
[Insert cool signature here]
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]
[Insert cool signature here]
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
- Houdini
Might it be possible for me to see an example of this. I find stl io classes a wee bit confusing

[Insert cool signature here]
[Insert cool signature here]
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
- Houdini
Sorry, i thought i looked up that pretty good but i did not find that article. Now it makes sense.

Thanks a lot for your time!

[Insert cool signature here]
[Insert cool signature here]

This topic is closed to new replies.

Advertisement