incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Created: (STDCXX-230) std::basic_istream::gcount() broken
Date Wed, 28 Jun 2006 18:38:29 GMT
std::basic_istream::gcount() broken
-----------------------------------

         Key: STDCXX-230
         URL: http://issues.apache.org/jira/browse/STDCXX-230
     Project: C++ Standard Library
        Type: Bug

  Components: 27. Input/Output  
 Environment: all
    Reporter: Martin Sebor


Moved from the Rogue Wave bug tracking database:

****Created By: pedretti @ Apr 18, 2001 03:51:32 PM****
basic_istream<>::gcount() is not ignoring characters consumed in formatted extraction
operations. 

[ example program: ]


#include <sstream>
#include <iostream>

using namespace std;


int main () {

    stringstream ss;
    string s;
    int i;
    char c;
    

    ss << "12345 5678 hello world" << ends;
    cout << "gcount() before extraction : " << ss.gcount() << endl;


    ss >> i;
    cout << "gcount() after formatted extraction of int: "
         << ss.gcount() << endl;

    ss >> i;
    cout << "gcount() after 2nd formatted extraction of int: "
         << ss.gcount() << endl;
    
    ss >> s;
    cout << "gcount() after formatted extraction of string: " << ss.gcount() <<
endl;
    

    while (ss) {
        ss >> c;
        cout << "gcount() after formatted  extraction of char: " << ss.gcount()
<< endl;
        
    }

}

[output:]

gcount() before extraction : 0
gcount() after formatted extraction of int: 0
gcount() after 2nd formatted extraction of int: 1
gcount() after formatted extraction of string: 1
gcount() after formatted extraction of char: 2
gcount() after formatted extraction of char: 1
gcount() after formatted extraction of char: 1
gcount() after formatted extraction of char: 1
gcount() after formatted extraction of char: 1
gcount() after formatted extraction of char: 1
gcount() after formatted extraction of char: 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message