CStdioFile and Seek-Method
-
Hello, i am using a CStdioFile object to read in a text-file. On some positions within the file i have to seek. I do it like this: CString line; CStdioFile file; ... /* Read a few lines */ while (condition) { file.ReadString(line) /* do something with line */ } /* Save current start-position for new line */ DWORD pos = file.GetPosition(); /* Read a few lines */ while (condition) { file.ReadString(line) /* do something with line */ } /* Go back to saved position */ file.Seek(pos,CFile::begin); Positioning the file-pointer by using the seek-method works only correct, if every line has a 0A 0D at the end. Now i have to parse a file that only has 0A at the end and the seek-method fails. It sets the file-pointer to the middle of a line and not to the beginning of the expected line. Please help! Best regards tabor25
-
Hello, i am using a CStdioFile object to read in a text-file. On some positions within the file i have to seek. I do it like this: CString line; CStdioFile file; ... /* Read a few lines */ while (condition) { file.ReadString(line) /* do something with line */ } /* Save current start-position for new line */ DWORD pos = file.GetPosition(); /* Read a few lines */ while (condition) { file.ReadString(line) /* do something with line */ } /* Go back to saved position */ file.Seek(pos,CFile::begin); Positioning the file-pointer by using the seek-method works only correct, if every line has a 0A 0D at the end. Now i have to parse a file that only has 0A at the end and the seek-method fails. It sets the file-pointer to the middle of a line and not to the beginning of the expected line. Please help! Best regards tabor25
-
Do you know whether ReadString() appends or overwrite previous data in a CString object? Kuphryn