public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/7235: iostream bug: cannot re-read a file.
@ 2002-07-08 10:46 Andrea Latina
  0 siblings, 0 replies; only message in thread
From: Andrea Latina @ 2002-07-08 10:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7235
>Category:       c++
>Synopsis:       If I open twice a file, I'm not able to read anything from it.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 08 10:46:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Andrea Latina
>Release:        3.1
>Organization:
>Environment:
System: Linux to427xl.to.infn.it 2.4.18-5smp #1 SMP Mon Jun 10 15:19:40 EDT 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.1/configure --enable-threads
>Description:
When I close a file previously opened, then I reopen it, I'm not able to read anything from the file. 
>How-To-Repeat:
I report the code exploiting the error:
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
        ifstream file("dati");

        if (file)
        {
                int x, y;

                while(file >> x >> y)	cout << x << '\t' << y << endl;


                file.close();
                file.open("dati");

		// the following line fails!

		while(file >> x >> y)	cout << x << '\t' << y << endl;


        }

        return 0;
}

where "dati" is a ascii file, like this:

10 10
20 20

for example.
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-07-08 17:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-08 10:46 c++/7235: iostream bug: cannot re-read a file Andrea Latina

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).