eurosport
You need to somehow format the numeric value into a string. One
method would be to create an ostringstream, and just stream
the number in, and extract the formatted character string to
show in the MessageBox. If you've tried this and failed,
it might be useful to post your attempt and say how it's
gone wrong.
If you're using MFC, the simplest way is probably to use
CString::Format.
If you're more comfortable with the C libraries, create
a buffer and use sprintf to fill the buffer appropriately.
Depending on what you're debugging, you might also consider
using OutputDebugString instead of MessageBox, since a
message box will change the messages sent to your window.
Strings printed with OutputDebugString will be displayed
by the debugger if you're running your program from the
debugger, or you can use a third party program like
DebugView (available on www.sysinternals.com) to see
those messages. This is often more convinient, since you
can save the debug messages to a file.
--
- Katy
Katy Mulvey HOME: http://mulvey.dyndns.com/~katy
Please post replies to VC++ FAQ: http://www.mvps.org/vcfaq
the newsgroup, thanks! MVP/VC++: http://support.microsoft.com/support/mvp
Thanx for the information but I guess for some reason I don't completely
know the proper way to format the values into string values using
ostringstream...
--
Morgan Vermef
--
mve...@yahoo.com
--
MS Allegiance Chancellor Team
ZONEIDs: Aviator1/Eurosprt1
--
ICQ# 5827864
"Katy Mulvey [MVP]" <k...@mvps.org> wrote in message
news:slrn91jp41....@teleman.aa2ys.ampr.org...
char sBuffer[100];
sprintf(sBuffer,"my float = %f", floatVar );
MessageBox(NULL,sBuffer,"See Ma? No hands", MB_OK);
? If not, please elaborate.
I can't remember a way of
> doing... I was told along time ago to use something like ostringstream but I
> can't figure it out... Any input would be great... I am trying to do some on
> screen debugging.
>
> eurosport
--
Morgan Vermef
--
mve...@yahoo.com
--
MS Allegiance Chancellor Team
ZONEIDs: Aviator1/Eurosprt1
--
ICQ# 5827864
"s.t. greives" <simpleto...@nosedive.worldnet.att.net> wrote in
message news:3A1A5ADE...@nosedive.worldnet.att.net...
// ...
#include <sstream>
#include <string>
//...
std::ostringstream myOSS;
// Assume that "value" is coming from somewhere in the //... above
myOSS << "The value is: " << value;
MessageBox(NULL, myOSS.str().c_str(), "Title", MB_OK);
//...
Pretty much, the same way you format values into any sort of C++
stream. If you need to control the format of the value, you
should also look at the I/O manipulators. I think you'd need
to #include <iomanip> to use them.