public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17611] New: ifstream could not read multiple files
@ 2004-09-22 15:32 kemin dot zhou at ferring dot com
2004-09-22 15:44 ` [Bug libstdc++/17611] " bangerth at dealii dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: kemin dot zhou at ferring dot com @ 2004-09-22 15:32 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/17611] ifstream could not read multiple files
2004-09-22 15:32 [Bug c++/17611] New: ifstream could not read multiple files kemin dot zhou at ferring dot com
@ 2004-09-22 15:44 ` 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
2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2004-09-22 15:44 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |libstdc++
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17611
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/17611] ifstream could not read multiple files
2004-09-22 15:32 [Bug c++/17611] New: ifstream could not read multiple files kemin dot zhou at ferring dot com
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
2 siblings, 0 replies; 4+ messages in thread
From: pcarlini at suse dot de @ 2004-09-22 15:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2004-09-22 15:55 -------
Not a bug, very well known, by the way, see:
http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#4_4_iostreamclear
The standard in force, as also clarifed by the resolution of DR22, does **not**
say that open clears the flags!
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17611
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/17611] ifstream could not read multiple files
2004-09-22 15:32 [Bug c++/17611] New: ifstream could not read multiple files kemin dot zhou at ferring dot com
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
2 siblings, 0 replies; 4+ messages in thread
From: kemin dot zhou at ferring dot com @ 2004-09-23 2:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kemin dot zhou at ferring dot com 2004-09-23 02:08 -------
Subject: Re: ifstream could not read multiple files
pcarlini at suse dot de wrote:
>------- Additional Comments From pcarlini at suse dot de 2004-09-22 15:55 -------
>Not a bug, very well known, by the way, see:
>
> http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#4_4_iostreamclear
>
>The standard in force, as also clarifed by the resolution of DR22, does **not**
>say that open clears the flags!
>
>
>
Thanks a lot. Well, some other compilers has the ability to ability to
open multiple files. Maybe we should change
the standard. I am not sure what is the benefit for leaving in the bad
state even after a close and re.open operation.
But this is a minor thing I can live with.
Kemin
**********************************************************************
Proprietary or confidential information belonging to Ferring Holding SA or to one of its affiliated companies may be contained in the message. If you are not the addressee indicated in this message (or responsible for the delivery of the message to such person), please do not copy or deliver this message to anyone. In such case, please destroy this message and notify the sender by reply e-mail. Please advise the sender immediately if you or your employer do not consent to e-mail for messages of this kind. Opinions, conclusions and other information in this message represent the opinion of the sender and do not necessarily represent or reflect the views and opinions of Ferring.
**********************************************************************
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17611
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-09-23 2:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-22 15:32 [Bug c++/17611] New: ifstream could not read multiple files kemin dot zhou at ferring dot com
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
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).