include "sys.m"; sys:= load Sys Sys->PATH; read: fn(fd: ref FD, buf: array of byte, nbytes: int): int; write: fn(fd: ref FD, buf: array of byte, nbytes: int): int; stream:fn(src, dst: ref FD, bufsiz: int): int;
The file offset is advanced by the number of bytes read so that subsequent reads will obtain the next data from the file.
It is not guaranteed that all nbytes bytes will be read. For example, if the file refers to the console, at most one line will be returned. The number of bytes read is returned as the functional value of read. A return value of 0 is conventionally interpreted as end of file.
The offset is advanced by the number of bytes written so that subsequent writes will deposit data after the previously written data.
The number of bytes actually written is returned by write. It should be regarded as an error if this is not the same as requested.
Limbo System Module
|
dup - duplicate an open file descriptor
|
open, create - open/create a file for reading or writing
|
bufio - buffered input/output module in Chapter 15
|