public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kemin dot zhou at ferring dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/17611] New: ifstream could not read multiple files
Date: Wed, 22 Sep 2004 15:32:00 -0000	[thread overview]
Message-ID: <20040922153153.17611.kemin.zhou@ferring.com> (raw)

ifstream objects could not open multiple files.
if ifstream objects have reached the end of the stream, then opening another
files requires to clear() otherwise it failed to open a second file.

example code:
ifstream IN("test1.txt");
while (IN>>line) cout << line << endl;
// at this point IN.bad() == true
IN.close();
// you must give the following command 
IN.clear();
// otherwise the following statement will fail
IN.open("test2.txt");
IN.fail() == true if the bad bit is not cleared.
====
The standard behavior is for the 
ifstream::open(string &infilename) {
  if (bad()) clear();
  ......
}

==========
reading file to the end in the first operation should not have prevented the
opening of the second file.

-- 
           Summary: ifstream could not read multiple files
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kemin dot zhou at ferring dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: Linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17611


             reply	other threads:[~2004-09-22 15:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-22 15:32 kemin dot zhou at ferring dot com [this message]
2004-09-22 15:44 ` [Bug libstdc++/17611] " bangerth at dealii dot org
2004-09-22 15:55 ` pcarlini at suse dot de
2004-09-23  2:08 ` kemin dot zhou at ferring dot com

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=20040922153153.17611.kemin.zhou@ferring.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).