Extracted from Pike v7.6 release 61 at 2005-12-30.
pike.ida.liu.se
[Top]
Stdio
Stdio.File

Method Stdio.File()->peek()


Method peek

int(-1..1) peek()
int(-1..1) peek(int|float timeout)

Description

Check if there is data available to read, or wait some time for available data to read.

Returns 1 if there is data available to read, 0 (zero) if there is no data available, and -1 if something went wrong.

See also

errno() , read()

Note

The function may be interrupted prematurely of the timeout (due to signals); check the timing manually if this is imporant.