#include <dirent.h>作用

#include    <dirent.h>

文件夹操作函数。GCC,非ANSI C。

作用不作为C标准的部分,而是被认为“冒充标准”并且可靠地是便携式的在平台之间。

含有以下类型和函数

DIR *dir;                        //DIR表示目录类型

/* struct dirent 结构体包含:

* ino_t  d_ino           file serial number
) char   d_name[]    name of entry

*/

struct dirent *stDir;    


int closedir(DIR *);
DIR *opendir(const char *);
struct dirent *readdir(DIR *);
int readdir_r(DIR *, struct dirent *, struct dirent **);
void rewinddir(DIR *);
void seekdir(DIR *, long int);
long int telldir(DIR *);

 

详见:http://pubs.opengroup.org/onlinepubs/007908799/xsh/dirent.h.html

-----------------------------------------------------------------------------------------------------

 NAME dirent.h - format of directory entries  SYNOPSIS

#include <dirent.h>

 DESCRIPTION The internal format of directories is unspecified.

The <dirent.h> header defines the following data type through typedef:

DIR A type representing a directory stream.

It also defines the structure dirent which includes the following members:


ino_t d_ino file serial number
char d_name[] name of entry

The type ino_t is defined as described in <sys/types.h>.

The character array d_name is of unspecified size, but the number of bytes preceding the terminating null byte will not exceed {NAME_MAX}.

The following are declared as functions and may also be defined as macros. Function prototypes must be provided for use with an ISO C compiler.


int closedir(DIR *);
DIR * opendir(const char *);
struct dirent * readdir(DIR *);
int readdir_r(DIR *, struct dirent *, struct dirent **);
void rewinddir(DIR *);
void seekdir(DIR *, long int);

long int telldir(DIR *);


转自:http://hi.baidu.com/w_dalu/blog/item/853ed146cb5c821b6a63e528.html


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值