Compartilhar via


istreambuf_iterator::char_type

A type that provides for the character type of the ostreambuf_iterator.

typedef CharType char_type;

Remarks

The type is a synonym for the template parameter CharType.

Example

// istreambuf_iterator_char_type.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <iostream>
#include <algorithm>

int main( )
{
   using namespace std;

   typedef istreambuf_iterator<char>::char_type CHT1;
   typedef istreambuf_iterator<char>::traits_type CHTR1;

   cout << "(Try the example: 'So many dots to be done'\n"
        << " then an Enter key to insert into the output,\n"
        << " & use a ctrl-Z Enter key combination to exit): ";

   // istreambuf_iterator for input stream
   istreambuf_iterator< CHT1, CHTR1> charInBuf ( cin );
   ostreambuf_iterator<char> charOut ( cout );

   // Used in conjunction with replace_copy algorithm
   // to insert into output stream and replace spaces
   // with dot-separators
   replace_copy ( charInBuf , istreambuf_iterator<char>( ),
        charOut , ' ' , '.' );
}
  So many dots to be done

FakePre-5f2580d898854d41b9e5ca08ffd1201c-87083be886be4f84a074ac5f4c6e2821

Requirements

Header: <iterator>

Namespace: std

See Also

Reference

istreambuf_iterator Class

Standard Template Library

Other Resources

istreambuf_iterator Members