iostream Programming
This section provides a general description of the iostream classes and then describes output streams, input streams, and input/output streams. The end of the section provides information about advanced iostream programming.
There is also a discussion on Thread Safety in the Standard C++ Library and the stdext namespace.
The ostringstream class comes handy when you need to replace sprintf. For example, if you have
sprintf(str, "Bakery number: %d", number);
DrawText (hdc, str, -1, &drawRect, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
you can use an ostringstream like this:
#include <sstream>
........
ostringstream s;
s << "Bakery Number: " << Number;
DrawText (hdc, s.str().data(), -1, &drawRect, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
- 9/10/2007
- alboreira