read - read files


<read $files [$offset [$length]]>

The read function reads each file given in $files and returns it in the corresponding value of $ret. If "-" (single dash) is given as a file, the standard input is read.

Normally the entire file is read. If an $offset is given, reading starts at that offset into the file. Negative offsets apply from the end of the file. If a $length is also given, that many bytes are read; the default is the rest of the file. Negative lengths indicate the rest of the file. The $offset and $length arguments are parallel to $files; if they have fewer values than $files the last value is re-used.

read returns a list of the contents of each file, from the indicated offset and length. Empty value(s) indicate an error reading the file or the file was empty.

The read function was added Sep. 17 1996. Support for reading standard input was added in version 2.6.939400000 19991008. The $offset and $length arguments were added in version 3.0.951100000 20000220.

If a file is to be immediately printed, the spew function is more efficient and saves memory.

READLN, spew, fetch, submit

Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.