line now has the first line of the file: "C++Draw Object File V1.0"Code:ifstream input_file("input.txt"); string line; getline( input_file, line, '\n' );
Now I do:
Notice the misspelling on the word File in line 2.Code:cout << line.compare("C++Draw Object File V1.0") << "\n"; cout << line.compare("C++Draw Object Fidle V1.0") << "\n";
The first line prints: "1"
The second line prints: "1"
Wtf?? How can they be the same??
How do I compare strings correctly?