怎样用C语言遍历每个文件夹

conectMouse 2007-10-02 08:06:54
我C书上有,不怎么明白,似乎是dir.h,findfirst,findnext
(注意是C语)
要能遍历每一个文件夹
...全文
619 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
fengdream 2007-10-03
  • 打赏
  • 举报
回复
findfirst, findnext
函数名: findfirst, findnext
功 能: 搜索磁盘目录; 取得下一个匹配的findfirst模式的文件
用 法: int findfirst(char *pathname, struct ffblk *ffblk, int attrib);
int findnext(struct ffblk *ffblk);
程序例:

/* findnext example */

#include <stdio.h>
#include <dir.h>

int main(void)
{
struct ffblk ffblk;
int done;
printf("Directory listing of *.*\n");
done = findfirst("*.*",&ffblk,0);
while (!done)
{
printf(" %s\n", ffblk.ff_name);
done = findnext(&ffblk);
}

return 0;
}

conectMouse 2007-10-03
  • 打赏
  • 举报
回复
...我当然知道啦..只是函数递归条件是什么
laiwusheng 2007-10-03
  • 打赏
  • 举报
回复
就是用这几个函数进行递归遍历的

69,373

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧