C++/File/Stream iterator
Use istream_iterator
#include <iostream>
#include <iterator>
using namespace std;
int main()
{
istream_iterator<char> in_it(cin);
do {
cout << *in_it++;
} while (*in_it != ".");
return 0;
}
Use ostream_iterator
#include <iostream>
#include <iterator>
using namespace std;
int main()
{
ostream_iterator<char> ostreamIterator(cout);
*ostreamIterator = "X";
ostreamIterator++;
*ostreamIterator = "Y";
ostreamIterator++;
*ostreamIterator = " ";
char str[] = "C++ Iterators are powerful.\n";
char *p = str;
while(*p) *ostreamIterator++ = *p++;
ostream_iterator<double> out_double_it(cout);
*out_double_it = 187.23;
out_double_it++;
*out_double_it = -102.7;
return 0;
}