std-ft-nth-line


Synopsis

(std-ft-nth-line <fname> <i>) ; single line

(std-ft-lines <fname> <from> <to>) ; list of lines

Description

std-ft-nth-line returns i'th line from the textfile or nil if not found or too short.

std-ft-lines returns a list of lines from the textfile or nil if not found. It returns a list of
to-from+1 lines, the to'th line is also returned, if existing.

The line number argument is one-based, the first line in the file is 1.

Example

(std-ft-nth-line (std-findfile "acad.pgp") 1)
=> "; This PGP file was created with the AutoCAD Alias Editor."

(std-ft-lines (std-findfile "acad.pgp") 1 2)
=> ("; This PGP file was created with the AutoCAD Alias Editor."
    "; Last modified 19.08.97   20:45:35")

Arguments

fname: A filename of an existing file.

from, to, i: A positive integer number.

Return Value

T on success or nil.

Side Effects

On success it changes the textfile.

Module

(std-require 'STDFILE)

Defined in STDFILE