-
File Input error...
I'm trying to read a file that uses 0xd7 and 0x0d as delimiters and the following code keeps failing:
Code:
bool readFile(string FileName, vector<string>* FileOutput) {
string currLine;
ifstream theFile(FileName.c_str());
if(theFile.is_open()) {
while(theFile.good()) {
getline(theFile,currLine);
FileOutput->push_back(currLine);
}
theFile.close();
return true;
}
return false;
}
Can anyone suggest a way around this? I'm really stuck.
I tried fixing the text file with a python script, but there to got an error: "UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 9: ordinal not in range(128)"
Thanks.
-
Fails how?
Tokenises on 0x0D, but doesn't on 0xD7 ?
Well you could do what you're doing at the moment, then add code following your getline to split all 0xD7 delimiters.
Doesn't read 0xD7 at all, for much the same reason as python?
Reads the last line twice, because of the broken while loop?