c++ - Why is the operand receiving an error message from binary expression? -
I am getting the following error:
Comparison between empty and non-indexing ( There is a code here for 'aka' ('original_first') and bin) binary expression (stream aka ('original_fstream') and long))
The reason for this is:
int main () {int arr [20] [6]; Fstream dataFile ("input.txt", iOS :: In); String input; Int I, I = 0; If (datafile == faucet) // error is on this line {cout & lt; & Lt; "Can not open file" & lt; & Lt; Endl; Return 0; }}
You might be following a tutorial that is pre-C ++ 11 and you are using a C + 11 compiler before C ++ 11, there was a
operator zero * conversion operator in section squares, where a tap pointer would represent a bad position . In C ++ 11, it was changed to
Clear Operator Bull conversion operator, which returns
false if the stream is in bad condition, then you can get your
if < / Code> statement should be changed:
If (! Datafile)
In fact, it is always a idiomatic way to look at the state of a stream ( Because this pre-C ++ 11 also works).
Comments
Post a Comment