Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.1.2, 4.1.3
-
None
-
all
Description
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
Attachments
Issue Links
- is blocked by
-
STDCXX-329 std::istream::sentry ctor affects gcount()
- Closed