Re: [dev] print utility

From: Charlie Kester <corky1951_AT_comcast.net>
Date: Sun, 31 Mar 2013 11:03:31 -0700

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