Read a specific line from a file: Difference between revisions

Added zkl
(→‎From the bottom: Trim garbage that doesn't seem to be a fragment of any solution on this page.)
(Added zkl)
Line 1,125:
char LineN(MaxLen);
if ReadLine(7, LineN) then Text(0, LineN)</lang>
 
=={{header|zkl}}==
Many zkl sequence objects contain a readln method, some contain a seek (or equivalent) method. However, File only has readln. If, for some, reason, the nth line can't be read, an exception is thrown.
<lang zkl>reg line; do(7){line=File.stdin.readln()} println(">>>",line);</lang>
Or, suck in lines and take the last one:
<lang zkl>lines:=File.stdin.readln(7); println(">>>",line[-1]);</lang>
 
 
[[Category:File handling]]
Anonymous user