dirent.h是POSIX.1标准定义的unix类目录操作的头文件,包含了许多UNIX系统服务的函数原型。
头文件的位置在/usr/include/dirent.h,里面有很多函数定义和宏,可以提供给我们非常丰富的目录处理方法。我们在编程中一般只需要简单的使用下面几个函数。
/* This is the data type of directory stream objects.
The actual structure is opaque to users. */
typedef struct __dirstream DIR;
/* Open a directory stream on NAME.
Return a DIR stream on the directory, or NULL if it could not be opened.
This function is a possible cancellation point and therefore not marked with __THROW. */
extern DIR *opendir (__const char *__name) __nonnull ((1));
/* Close the directory stream DIRP.
Return 0