FD_DIRECTORY(3H) — Pixar Programmer’s Manual — libfd
NAME
fd_opendir− open fast-disk directory for reading
fd_readdir− read next entry in fast-disk directory
fd_closedir− close fast-disk directory
SYNOPSIS
#include <fd.h>
FD_DIR ∗fd_opendir(dirname)
char ∗dirname;
struct fddirect ∗fd_readdir(dp)
FD_DIR ∗dp;
fd_closedir(dp)
FD_DIR ∗dp;
DESCRIPTION
Fd_opendir opens the directory named by dirname and associates a directory stream with it. Fd_opendir returns a pointer used to identify the directory stream in subsequent operations. The pointer NULL is returned if dirname cannot be accessed, if dirname is not a directory, or if malloc(3) cannot provide enough memory to hold the context for the directory stream.
Fd_readdir returns a pointer to a struct direct representing the next directory entry. It returns NULL upon reaching the end of the directory. The struct direct contains only one element, d_name, which is the NUL-terminated name of the file.
Fd_closedir closes a directory stream and frees the context associated with it.
Sample code which prints all the entries in the current directory is:
FD_DIR ∗dirp;
struct fddirect ∗dp;
dirp = opendir(".");
if (dirp == NULL)
return;
while (dp = fd_readdir(dirp))
puts(dp->d_name);
closedir(dirp);
return;
SEE ALSO
Release β — Last change: 10/12/88