Extracted from Pike v7.3 release 14 at 2002-02-15.
pike.roxen.com
[Top]
Stdio
Stdio.Fd

Method Stdio.Fd()->read()


Method read

string Stdio.Fd()->read()
string Stdio.Fd()->read(int len)
string Stdio.Fd()->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 Stdio.Fd.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, Stdio.Fd.read will read to the end of the file/stream.

See also

Stdio.Fd.read_oob, Stdio.Fd.write