1.1.13.3 custom stream

  1. peek return the next character from input without extracting from the input stream. For example, you want to read input up to the first newline or period.
    char input[80]; 
    int i = 0; 
    while( (ch=cin.peek()) != . && ch != \n) 
       cin.get(input[i++];) 
    input[i] = \0;
  2. gcount() method returns the number of characters read by the last unfromatted extraction method. That means character read by the a get(), getline(), ignore(), or read(), but not extraction operator.
  3. putback() function inserts a character back in the input buffer.