file-lines ( path encoding -- seq )
Factor handbook » Input and output » Reading and writing files

Prev:change-file-contents ( ..a path encoding quot: ( ..a seq -- ..b seq' ) -- ..b )
Next:set-file-lines ( seq path encoding -- )


Vocabulary
io.files

Inputs
patha pathname string
encodingan encoding descriptor


Outputs
seqan array of strings


Word description
Opens the file at the given path using the given encoding, and returns a list of the lines in that file.

Examples
USING: io.files io.encodings.utf8 prettyprint sequences ; "resource:core/kernel/kernel.factor" utf8 file-lines first .
"! Copyright (C) 2004, 2009 Slava Pestov."


Errors
Throws an error if the file cannot be opened for reading.

See also
set-file-lines, change-file-lines, set-file-contents, file-contents, change-file-contents

Definition