Pike v8.1 release 6

Method Stdio.Fd()->close()


Method close

int close()
int close(string direction)

Description

Close a file or stream.

If direction is not specified, both the read and the write direction is closed. Otherwise only the directions specified is closed.

Returns

Nonzero is returned if the file or stream wasn't open in the specified direction, zero otherwise.

Throws

An exception is thrown if an I/O error occurs.

The default behaviour for sockets is typically to flush buffered data in the background, but this can be changed with linger().

Note

close() has no effect if this file object has been associated with an already opened file, i.e. if open() was given an integer as the first argument.

See also

linger(), open(), open_socket()