fopen()不能打开文件后缀名大于3字节的文件

Lub-esp
Posts: 3
Joined: Wed May 10, 2023 5:53 am

fopen()不能打开文件后缀名大于3字节的文件

Postby Lub-esp » Thu Jul 13, 2023 4:50 pm

  1. #include <sys/unistd.h>
  2. #include <sys/stat.h>
  3. #include "esp_vfs_fat.h"
  4. #include "sdmmc_cmd.h"
使用sdspi例程,初始化并mount sdcard文件系统后,使用fopen()不能打开文件后缀名大于3字节的文件
  1. const char *_file = "/sdcard/hello.abcd";
  2. FILE *f = fopen(_file, "wb");
  3. if (f == NULL) {
  4.     ESP_LOGE("file test", "Failed to open file for writing");
  5.     return;
  6. }
比如这样总是打开失败,但如果const char *_file = "/sdcard/hello.abc";就不会有问题。
是历史遗留问题吗?有没有解决方法呢?


Lub-esp
Posts: 3
Joined: Wed May 10, 2023 5:53 am

Re: fopen()不能打开文件后缀名大于3字节的文件

Postby Lub-esp » Tue Jul 18, 2023 4:02 am

ESP_igrr wrote:
Thu Jul 13, 2023 9:13 pm
Please see https://github.com/espressif/esp-idf/is ... 1539299549
Thanks a lot.

Who is online

Users browsing this forum: Google Adsense [Bot] and 32 guests