User Tools

Site Tools


c_-_c_streams:buffer_iterator

C - C++ Streams - Buffer iterator

#include <iostream>
#include <iterator>
#include <string>
using namespace std;
 
int main () 
{
  string name;
  istreambuf_iterator<char> eos;   
  istreambuf_iterator<char> iit (cin.rdbuf());
 
  while (iit!=eos && *iit!='\n') 
    name+=*iit++;
 
  cout << "Entered string is " << name << ".\n";
 
  return 0;
}
c_-_c_streams/buffer_iterator.txt · Last modified: 2020/07/15 10:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki