다음을 통해 공유


istreambuf_iterator::operator*

The dereferencing operator returns the next character in the stream.

CharType operator*( ) const;

Return Value

The next character in the stream.

Example

// istreambuf_iterator_operator_deref.cpp
// compile with: /EHsc
#include <iterator>
#include <iostream>

int main( )
{
   using namespace std;

   cout << "Type string of characters & enter to output it,\n"
      << " with stream buffer iterators,(try: 'I'll be back.')\n"
      << " repeat as many times as desired,\n" 
      << " then keystroke ctrl-Z Enter to exit program: ";
   istreambuf_iterator<char> inpos ( cin );
   istreambuf_iterator<char> endpos;
   ostreambuf_iterator<char> outpos ( cout );
   while ( inpos != endpos )
   {
      *outpos = *inpos;   //Put value of outpos equal to inpos
      ++inpos;
      ++outpos;
   }
}

I'll be back.

Type string of characters & enter to output it,
 with stream buffer iterators,(try: 'I'll be back.')
 repeat as many times as desired,
 then keystroke ctrl-Z Enter to exit program: I'll be back.
I'll be back.
^Z

Requirements

Header: <iterator>

Namespace: std

See Also

Concepts

istreambuf_iterator Class

istreambuf_iterator Members

Standard Template Library