Is it possible to do something like cout << "my string"; and have my string capitalized? from what i can tell there is no way to do it? i need to wrap it around a function
+4
A:
Yes, you can extend std:streambuf See this example: http://www.java2s.com/Tutorial/Cpp/0240__File-Stream/Extendsstdstreambuftocreateoutputbuffer.htm
Pierre
2009-01-26 10:45:55
Filtering streambufs are indeed the way to go. You can also have a look at James Kanze's articles on the subject, and on boost.io that provides a framework inspired by James' article, that help defining filters.
Luc Hermitte
2009-01-26 13:51:40
A:
Use the Boost string_algo library:
string myStr("my string");
to_upper(myStr);
cout << myStr;
MattyT
2009-01-26 12:57:01