public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: castaway@desert-island.m.isar.de
To: gcc-gnats@gcc.gnu.org
Subject: libstdc++/8637: istream& get (char* s, streamsize n, char delim ) does not work
Date: Mon, 25 Nov 2002 14:46:00 -0000	[thread overview]
Message-ID: <20021119141402.2230.qmail@sources.redhat.com> (raw)


>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:


             reply	other threads:[~2002-11-19 14:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-25 14:46 castaway [this message]
2002-11-29  1:49 paolo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021119141402.2230.qmail@sources.redhat.com \
    --to=castaway@desert-island.m.isar.de \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).