Q: How to read a text file line by line?
A: Simply, by using CStdioFile MFC class.
As for example:
Code:void CWhateverClass::ReadTextFile(LPCTSTR pszFileName, CStringArray& arrLines) { arrLines.RemoveAll(); CString strLine; TRY { CStdioFile file(pszFileName, CFile::modeRead); while(file.ReadString(strLine)) arrLines.Add(strLine); } CATCH_ALL(e) { e->ReportError(); // shows what's going wrong } END_CATCH_ALL }