getline at a certain line for file IO
- by BSchlinker
Is there anyway to use getline to read a specific line within a file? For instance, to immediately read line #20?
It seems inefficient to do any type of look to read and discard earlier lines. I know about fseek, but there is no guarantee that the records will be the same length on each line.
I imagine this is simply what is required in order to find lines. After all, to know when the end of the line has been reached, it needs to find the break line character, so it makes sense for it to need to read each line.
Just wondering if there was any quicker method.