J
Joe
Hello all,
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=0;ix!=10;ix++)
cout<<prediction[ix]<<endl;",
the error message did not display.
Can anybody tell me why? I really dont know the reason.
The codes are listed below,
int main(){
vector<float> prediction, observation;
ifstream infile("the_obtained_output");
if (!infile){
cerr<<"error: unable to open the input file: "<<infile<<endl;
return -1;
}
for(float i;infile>>i
prediction.push_back(i);
for(vector<float>::size_type ix=0;ix!=10;ix++)
cout<<prediction[ix]<<endl;
infile.close();
infile.open("verification1");
if (!infile){
cerr<<"error: unable to open the input file: "<<infile<<endl;
return -1;
}
return 0;
}
Thank you, all.
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=0;ix!=10;ix++)
cout<<prediction[ix]<<endl;",
the error message did not display.
Can anybody tell me why? I really dont know the reason.
The codes are listed below,
int main(){
vector<float> prediction, observation;
ifstream infile("the_obtained_output");
if (!infile){
cerr<<"error: unable to open the input file: "<<infile<<endl;
return -1;
}
for(float i;infile>>i
prediction.push_back(i);
for(vector<float>::size_type ix=0;ix!=10;ix++)
cout<<prediction[ix]<<endl;
infile.close();
infile.open("verification1");
if (!infile){
cerr<<"error: unable to open the input file: "<<infile<<endl;
return -1;
}
return 0;
}
Thank you, all.