FAT | RFS | XFS | ZFS
closedir()
PROTOTYPE
#include <posix.h>
int closedir(DIR *dirp);
DESCRIPTION
closedir() frees the file control block identified by dirp, a handle previously returned by opendir() and closes the directory. After closedir() returns, the value of dirp no longer references the directory.
If successful, closedir() returns 0. Otherwise, it sets errno and returns -1.
ERROR CODES
| EBADF | dirp is not the handle of an open directory. |
EXAMPLE
/*-------------------------------------------------------------*/
/* Close directory and return if error. */
/*-------------------------------------------------------------*/
if (closedir(cur_dir))
{
perror("closedir() failed");
return -1;
}