include "sys.m"; sys := load Sys Sys->PATH; dirread: fn(fd: ref FD): (int, array of Dir);
A successful dirread returns a tuple giving the number of entries read and the resulting array. A return of (0,nil) indicates the end of the directory. Directory entries are variable length in general; the file offset is advanced by the number of bytes actually read.
Seeks (see sys-seek(2)) are allowed on directories only to seek to the start.
In general, several calls to dirread will be needed to read the whole directory. Readdir (2) provides functions that return all the directory entries at once, optionally sorted.
SYS-DIRREAD(2 ) | Rev: Thu Feb 15 14:43:27 GMT 2007 |