Reading long lines from text file
- by sonofdelphi
I am using the following code for reading lines from a text-file. What is the best method for handling the case where the line is greater than the limit SIZE_MAX_LINE?
void TextFileReader::read(string inFilename)
{
ifstream xInFile(inFilename.c_str());
if(!xInFile){
return;
}
char acLine[SIZE_MAX_LINE + 1];
while(xInFile){
xInFile.getline(acLine, SIZE_MAX_LINE);
if(xInFile){
m_sStream.append(acLine); //Appending read line to string
}
}
xInFile.close();
}