Pike v8.0 release 1738

Method Stdio.read_file()


Method read_file

string read_file(string filename)
string read_file(string filename, int start, int len)

Description

Read len lines from a regular file filename after skipping start lines and return those lines as a string. If both start and len are omitted the whole file is read.

Throws

Throws an error on any I/O error except when the file doesn't exist.

Returns

Returns 0 (zero) if the file doesn't exist or if start is beyond the end of it.

Returns a string with the requested data otherwise.

See also

read_bytes(), write_file()