Anonymous user
Read a specific line from a file: Difference between revisions
Changed program to use a procedure which returns the line.
m (→{{header|Phix}}: added syntax colouring the hard way) |
(Changed program to use a procedure which returns the line.) |
||
Line 1,249:
=={{header|Nim}}==
<lang nim>
f = open("test.txt", fmRead)▼
proc readLine(f: File; num: Positive): string =
for
try:
result = f.readLine()
except
raise newException(IOError, &"Not enough lines in file; expected {num}, found {n - 1}.")
echo f.readLine(7)
f.close()
</lang>
=={{header|OCaml}}==
|