On Jul 15, 1:16 pm, "Jim Langston" <tazmas...@[EMAIL PROTECTED]
> wrote:
> "Joe" <liuj0...@[EMAIL PROTECTED]
> wrote in message
> news:2e4dbb2c-f4ab-4fc2-9c65-e1b9d22b89fb@[EMAIL PROTECTED]
> > I dont know how to fix it. The program is to open a file
> > "the_obtained_output", then open another file "verification1". The
> > first file can be opened successfully but I got a error message
> > "error: unable to open the input file: 000000".
> > I checked the codes, I found if I removed
> > "for(float i;infile>>i;)
> > prediction.push_back(i);
> > for(vector<float>::size_type ix=3D0;ix!=3D10;ix++)
> > cout<<prediction[ix]<<endl;",
> > the error message did not display.
> > Can anybody tell me why? I really dont know the reason.
> Personally I don't reuse ifstreams myself. I would just give
> the 2nd one a different variable name.
That's certainly the best solution.
In his case, the problem is simple: he only stops reading the
first file when an input fails. And the failure flag is sticky;
all stream operations effectively become a no-op until it is
cleared. An "infile.clear()" before the second open should do
the trick.
--
James Kanze (GABI Software) email:james.kanze@[EMAIL PROTECTED]
en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34


|