closedir

Closes a specified directory.

Library:LibC
Classification:POSIX
Service:File and Directory I/O

Syntax

  #include <dirent.h> 
   
  int closedir (
     DIR   *dirp); 
  

Parameters

dirp

Specifies the directory to be closed. For information about the structure, see DIR.

Return Values

If successful, returns 0. Otherwise, returns -1 and sets errno to one of the following:

Decimal

Constant

Description

4

EBADF

The dirp argument does not refer to an open directory stream.

63

EINTR

The closedir function was interrupted by a signal.

Remarks

The closedir function closes the directory specified by the dirp parameter and frees the memory allocated by the opendir function. All open directories are automatically closed when an NLMâ„¢ application is terminated.

See Also