[Top] [Prev] [Next]

dirread - read directory

include "sys.m";
sys:= load Sys Sys->PATH;
dirread: fn(fd: ref FD, dir: array of Dir): int;


dirread (fd, dir)

The dirread function reads the contents of the directory pointed to by the open file descriptor fd, filling in the array dir with one Dir structure for each element. These Dir structures are equivalent to the result of a stat call on each file in the directory. See stat, fstat, fwstat, wstat - get and put file status for a description of stat and Dir.

A successful dirread returns the number of entries read up to the length of array dir. The number returned may be less than the number requested. The file offset is advanced by the number of bytes actually read. A return of 0 indicates the end of the directory.

Seeks (see seek - change file offset) are not allowed on directories.

See Also
Limbo System Module

open, create - open/create a file for reading or writing

read, write, stream - read, write, or stream file

seek - change file offset

stat, fstat, fwstat, wstat - get and put file status

readdir - read directory and sort files in Chapter 15

[Top] [Prev] [Next]

Copyright © 1996,Lucent Technologies, Inc. All rights reserved.