Extracted from Pike v7.4 release 117 at 2004-07-26.
pike.ida.liu.se
[Top]
predef::
Stdio
Stdio.File

Method Stdio.File()->read()


Method read

string read()
string read(int len)
string read(int len, int(0..1) not_all)

Description

Read data from a file or a string.

Attempts to read len bytes from the file, and return it as a string. If something goes wrong, zero is returned.

If a one is given as the second argument to read() , it will not try its best to read as many bytes as you have asked for, but will merely try to read as many bytes as the system read function will return. This mainly useful with stream devices which can return exactly one row or packet at a time.

If no arguments are given, read() will read to the end of the file/stream.

See also

read_oob() , write()