The following code when run always returns 0 for in_avail()
To reproduce, just compile the following code with g++ with no commandline
switches and run the resulting binary. 

#include <iostream>
using namespace std;

int main () {

  streamsize size;
  char ch;

  streambuf * pbuf;
  pbuf = cin.rdbuf();

  cout << "Please enter some characters: ";
  cin >> ch;

  size = pbuf->in_avail();

  cout << "The first character you entered is: " << ch << endl;
  cout << size << " additional characters in input buffer" << endl;

  return 0;
}


-- 
           Summary: cin.rdbuf->in_avail() always return 0
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: raj dot khem at gmail dot com
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24206

Reply via email to