[Tutor] Help required to count no of lines that are until 1000 characters

Alan Gauld alan.gauld at btinternet.com
Tue May 11 23:45:34 CEST 2010


"spir ☣" <denis.spir at gmail.com> wrote

> Either you read line per line, but then you cannot stop exactly at the 1000th 
> character;
> or you traverse the text char per char, but this is a bit picky.

Or you could just read 1000 chars from the file then pick out the lines from 
that.
But that requires you to count newlines as characters! :-)

HTH,

Alan G.




More information about the Tutor mailing list