in reply to Best way to read line x from a file
Other thing that you can do, to avoid to alwasy read all the file, is to save something like an index of the position in bytes of some lines in an extra file. Soo, for a big file you can have some indexed lines, and when you want to go to line X, you choose the nearest indexed line to start to search for line X, but note that the search for the nearest line in the index need to be very fast and small, or you won't get too much optimization.
Graciliano M. P.
"Creativity is the expression of the liberty".
|
|---|