closedir [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation
MPE/iX Developer's Kit Reference Manual Volume I
closedir
Closes a directory stream.
Syntax
#include <sys/types.h>
#include <dirent.h>
int closedir (DIR *dirp);
Parameters
dirp A pointer to a structure of type DIR representing an open
directory stream (returned by a call to opendir()).
Return Values
0 Success. The directory is closed.
-1 An error occurred. The directory file is not closed, and
errno is set to indicate the error condition.
Description
The closedir() function closes the open directory file pointed to by
dirp. The directory stream must be a structure of type DIR (defined in
<dirent.h>) returned from a successful call to opendir(), or an error
occurs. The file descriptor associated with the DIR structure is also
closed.
Implementation Considerations
Refer to the EFAULT error description below.
The DIR structure is implemented using a file descriptor.
Errors
If an error occurs, errno is set to one of the following values:
EBADF CAUSE The dirp parameter does not point to an open
directory stream.
ACTION Pass a pointer to an open directory stream returned
by the opendir() function.
EFAULT CAUSE The system detected a NULL or bad address in
attempting to use the dirp parameter.
ACTION Make sure that the pointer is correctly initialized.
See Also
opendir(), readdir(), rewinddir(), <dirent.h>, POSIX.1 (Section 5.1.2)
MPE/iX 5.0 Documentation