硬汉嵌入式论坛

 找回密码
 立即注册
查看: 3696|回复: 1
收起左侧

[FatFs] 函数f_findfirst的使用,此函数已经包含 f_opendir 和 f_readdir

[复制链接]

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106746
QQ
发表于 2017-7-18 01:16:01 | 显示全部楼层 |阅读模式
http://elm-chan.org/fsw/ff/doc/findfirst.html



  1. /* Search a directory for objects and display it */
  2. void find_image_file (void)
  3. {
  4.     FRESULT fr;     /* Return value */
  5.     DIR dj;         /* Directory search object */
  6.     FILINFO fno;    /* File information */
  7.     fr = f_findfirst(&dj, &fno, "", "dsc*.jpg");  /* Start to search for photo files */
  8.     while (fr == FR_OK && fno.fname[0]) {         /* Repeat while an item is found */
  9.         printf("%s\n", fno.fname);                /* Display the object name */
  10.         fr = f_findnext(&dj, &fno);               /* Search for next item */
  11.     }
  12.     f_closedir(&dj);
  13. }
复制代码
回复

使用道具 举报

11

主题

43

回帖

76

积分

初级会员

积分
76
发表于 2020-7-9 15:39:56 | 显示全部楼层
@硬汉哥 你好 我用你的例程跑f_readdir后 去查看文件dir.index显示出来的都是2的倍数 index不应该是正常递增吗 为什么用printf(" %d",DirInf.index);打印出来的是2的倍数呢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-3 15:55 , Processed in 0.250595 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

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