fseek() by line, not bytes?

doom990

New Member
I have a script that parses large files line by line. When it encounters an error that it can't handle, it stops, notifying us of the last line parsed.Is this really the best / only way to seek to a specific line in a file? (\[code\]fseek()\[/code\] is not usable in my case.)\[code\]<?phpfor ($i = 0; $i < 100000; $i++) fgets($fp); // just discard this\[/code\]I don't have a problem using this, it is fast enough - it just feels a bit dirty. From what I know about the underlying code, I don't imagine there is a better way to do this.
 
Back
Top