include "readdir.m"; readdir:= load Readdir Readdir->PATH; NAME, ATIME, MTIME, SIZE, NONE: con iota; DESCENDING : con (1<<5); init: fn(path: string, sortkey: int): (array of ref Dir, int);
Each element in the returned array is a reference to one Dir element in the array formed by the dirread system call. Readdir also returns the number of entries read, or -1 on failure.
The sorting criteria for the returned array are based on sortkey as follows:
If the value DESCENDING is OR'ed into any of the above values (except NONE) the order of sorting is reversed.
See Also
read, write, stream - read, write, or stream file in Chapter 8