Thursday, July 30, 2009

Binary error in C++? How to fix?

epsfile.open("EPS.DAT", ios::in);


if(epsfile)


{


do


{


epsfile %26gt;%26gt; epsfile[i];


i++;


}


while (epsfile[i - 1] !="End");


}


epsfile.close();

















Both places that the "[ ]" appear seem to be having issues, the compiler says that std::ifstream doesn't define the operator. No sure what to do to fix it. I have included iostream, ifstream, string, and vector. Is there something i'm missing?

Binary error in C++? How to fix?
As the compiler says, there is no operator[ ] for ifstream. The two statements where you're trying to index into epsfile are invalid. I'm not even sure what you're trying to do with the statement: epsfile %26gt;%26gt; epsfile[i]. I guess you're trying to read from the file, but your syntax is wrong.





Have a look here:


http://www.cplusplus.com/doc/tutorial/fi...


No comments:

Post a Comment