On 03/31/2013 10:37, Bjartur Thorlacius wrote:
> On 03/31/2013 01:52 PM, Charlie Kester wrote:
>> I'd read the file one character at a time, counting newlines, until I
>> reached the desired line. [..] Doing it this way avoids the need for a
>> buffer altogether, along with any guessing about possible line lengths.
> Reading is expensive. Loop through an optimally sized buffer and
> incrementally count newlines.
Why add this extra complexity when stdio is already buffering the input
stream?
Received on Sun Mar 31 2013 - 20:03:31 CEST
This archive was generated by hypermail 2.3.0
: Sun Mar 31 2013 - 20:00:07 CEST