C++ STL C++ STL ostreambuf_iterator::ostreambuf_iterator program example
Compiler: Visual C++ Express Edition 2005
Compiled on Platform: Windows XP Pro SP2
Header file: Standard
Additional project setting: Set project to be compiled as C++
Project -> your_project_name Properties -> Configuration Properties -> C/C++ -> Advanced -> Compiled As: Compiled as C++ Code (/TP)
Other info: none
To do: Using the C++ ostreambuf_iterator::ostreambuf_iterator to construct an ostreambuf_iterator that is initialized to write characters to the output stream in C++ programming
To show: How to use the C++ ostreambuf_iterator, ostreambuf_iterator to construct an ostreambuf_iterator that is initialized to write characters to the output stream in C++ programming
// ostreambuf_iterator, ostreambuf_iterator
using namespace std;
// ostreambuf_iterator for stream cout
// assign/insert characters
*charOut = '7';
*charOut = 'T';
*charOut = 'W';
// print the result
cout<<" are characters output."<<endl;
string str = "These characters are being written to the output stream.\n ";
copy(str.begin(), str.end(), strOut);
7TW are characters output.
These characters are being written to the output stream.
Press any key to continue . . .