I do have this piece of code
// Open the file
infile.open(filename);
if (!infile) {
stockmsg << "InputData::read: Failed trying to open file " << filename << endl;
return NULL;
}
// Header line confirms if right kind of file
// In the future, might need to check the version number
count++;
infile >> keyword;
if (keyword != "#STOCK") {
stockmsg << "InputData::read : input file header line unrecognised" << endl;
return NULL;
}
getline(infile,nextline,'\n'); // Discard the rest of the line
// Read the file line by line
etree = NULL;
while (status == READ_SUCCESS) {
count++;
// +++++++++++++++
// KEYWORDS stage
// +++++++++++++++
// When in KEY_WORDS mode, try to get another line
if (stage == KEY_WORDS) {
if (getline(infile,nextline,'\n') == 0) {
stockmsg << "InputData::read : unexpected end of file at line " << count << endl;
status = READ_FAILURE;
break;
}
When I compile, I get an error message
error: no match for 'operator=='
(operand types are 'std::basicistream<char>' and 'int')
if (getline(infile,nextline,'\n')==0) {
I am not sure how to fix this.