include "sys.m"; sys:= load Sys Sys->PATH; open: fn(file: string, omode: int) : ref FD; create:fn(file: string, omode, perm: int): ref FD;
open for reading|
open for writing|
open for reading and writing|
The following values may be OR'ed with the above values for additional actions:
Truncate the file before opening it; this requires write permission even if omode is Sys->OREAD.|
Remove the file on closure.|
The open function returns nil if the file does not exist or the user does not have permission to open it as requested (see stat for a description of permissions).
create (file, omode, perm)
The create function creates a new file or prepares to rewrite an existing file, opens it according to omode (as described for open), and returns an associated file descriptor.
If the file already exists, it is truncated to 0 length, and the permissions, owner, and group remain unchanged.
There is no explicit 'close' routine; when the last reference to the file descriptor is released, the system closes the associated file.
Limbo System Modules: bind, stat, and open