public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/8637: istream& get (char* s, streamsize n, char delim ) does not work
@ 2002-11-25 14:46 castaway
0 siblings, 0 replies; 2+ messages in thread
From: castaway @ 2002-11-25 14:46 UTC (permalink / raw)
To: gcc-gnats
>Number: 8637
>Category: libstdc++
>Synopsis: istream& get (char* s, streamsize n, char delim ) does not work
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Nov 19 06:16:08 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: castaway@desert-island.m.isar.de
>Release: gcc30-3.0.4-25 (SuSE 8.0) and g++ (GCC) 3.2.1 20021108
>Organization:
>Environment:
SuSE 8.0 / i686-pc-linux-gnu
>Description:
3.0.4 was a standard SuSE 8.0
3.2.1 : --host=i686-pc-linux-gnu --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-__cxa_atexit --enable- --enable-clocale=gnu
istream& get (char* s, streamsize n, char delim ) should read text until the next delimiter given, _and leave the delimiter on the stream_ (worked in 2.95.3)
>How-To-Repeat:
Example:
1. Create a file with contents "" (double quotes) and nothing else) - programm produces a seg-fault, when run through gdb it produces incorrect output (both delimiters should be ")
2. Create a file with contents "test" - this produces correct output in gcc 3.0.4 but not in 3.2.1.
- Both examples work in 2.95.3
// istream get
#include <iostream>
#include <fstream>
using namespace std;
int main () {
char * c, str[256];
ifstream is;
char delim;
cout << "Enter the name of an existing text file: ";
cin.get (str,256);
is.open (str); // open file
delim = is.get();
cout << "Delimiter: " << delim << endl;
is.get(c, 50, '"'); // get character from file
cout << c << endl;
if(is.fail())
{
cout << "Failed" << endl;
}
delim = is.get();
cout << "Delimiter: " << delim << endl;
is.close(); // close file
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: libstdc++/8637: istream& get (char* s, streamsize n, char delim ) does not work
@ 2002-11-29 1:49 paolo
0 siblings, 0 replies; 2+ messages in thread
From: paolo @ 2002-11-29 1:49 UTC (permalink / raw)
To: castaway, gcc-bugs, gcc-prs, nobody, paolo
Synopsis: istream& get (char* s, streamsize n, char delim ) does not work
Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Wed Nov 20 12:42:27 2002
Responsible-Changed-Why:
Analyzed.
State-Changed-From-To: open->closed
State-Changed-By: paolo
State-Changed-When: Wed Nov 20 12:42:27 2002
State-Changed-Why:
Not a bug, but ISO standard behaviour: see 27.6.1.3,7 or
Josuttis p. 608 for a start.
(in particular, notice that the first parameter of
istream::get is a char* not a char!)
Iostreams have been completely rewritten for 3.x and are
now much more conformant.
Thanks for your report, Paolo.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8637
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-11-20 20:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-25 14:46 libstdc++/8637: istream& get (char* s, streamsize n, char delim ) does not work castaway
2002-11-29 1:49 paolo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).