This is the mail archive of the
mailing list for the libstdc++ project.
Re: [bug] istream::getline(char*,streamsize) still broken
- To: libstdc++ at sourceware dot cygnus dot com
- Subject: Re: [bug] istream::getline(char*,streamsize) still broken
- From: Benjamin Kosnik <bkoz at redhat dot com>
- Date: Sat, 22 Jul 2000 12:09:29 -0700
I'm ready to concede. I've looked at existing practice and scoped the
reflector archives. It was my contention that after n - 1 characters
were extracted (ie, after 'd' in "abcd") that no more characters were
We are/were both in agreement about what gcount() returns.
This seems to be wrong. Here's what should happen (I'm hoping we can
now easily agree on this:)
using namespace std;
bool test = true;
const streamsize it = 5;
const char* str_lit = "abcd\n";
stringbuf strbuf(str_lit, std::ios_base::in);
test &= istr.gcount() == it; // extracted whole string
test &= strlen(tmp) == 4; // stored all but '\n'
test &= !istr.eof(); // extracted up to but not eof
test &= !istr.fail(); // failbit not set
char c = 'z';
test &= c == 'z';
test &= istr.eof();
If you can re-submit your patch reflective of this, patch up any
testcase weirdness and add the above, that would be cool.