曲径通幽论坛

 找回密码
 立即注册
搜索
查看: 4329|回复: 0
打印 上一主题 下一主题

readdir

[复制链接]

4918

主题

5880

帖子

3万

积分

GROAD

曲径通幽,安觅芳踪。

Rank: 6Rank: 6

积分
34395
跳转到指定楼层
楼主
发表于 2008-11-16 23:13:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
名称:
       readdir - 读一个目录

包含头文件:

       #include <sys/types.h>

       #include <dirent.h>

原型:
       struct dirent *readdir(DIR *dir);

描述:
       The  readdir()  function  returns a pointer to a dirent structurerepresenting the next directory entry in the directory stream pointedto by dir.  It returns NULL on reaching the end-of-file or if an erroroccurred.
(eaddir() 函数返回一个指向 dirent structure(结构) 的指针,在这个结构中描述了由 dir所指向的目录流中下一个目录入口< off_t   d_off;       /* offset to the next dirent*/> )

--------
目录更确切的说,是记录的序列,每条记录对应一个文件或子目录(这些记录就相当上面所翻译的“目录入口”,从这些“入口”就可以到达要访问的文件或子目录)。

通过 readdir 来读取目录中的记录,readdir 是返回一个指向目录的当前记录的指针(而这个目录中包含着下一个 dirent 结构入口信息的偏移)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|曲径通幽 ( 琼ICP备11001422号-1|公安备案:46900502000207 )

GMT+8, 2025-5-4 01:07 , Processed in 0.079226 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表