From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8087 invoked by alias); 22 Sep 2004 15:32:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 8075 invoked by uid 48); 22 Sep 2004 15:31:58 -0000 Date: Wed, 22 Sep 2004 15:32:00 -0000 From: "kemin dot zhou at ferring dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20040922153153.17611.kemin.zhou@ferring.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/17611] New: ifstream could not read multiple files X-Bugzilla-Reason: CC X-SW-Source: 2004-09/txt/msg02558.txt.bz2 List-Id: 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