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

Code: Untitled.c Select all


#include <sys/unistd.h>
#include <sys/stat.h>
#include "esp_vfs_fat.h"
#include "sdmmc_cmd.h"
使用sdspi例程,初始化并mount sdcard文件系统后,使用fopen()不能打开文件后缀名大于3字节的文件

Code: Untitled.c Select all


const char *_file = "/sdcard/hello.abcd";
FILE *f = fopen(_file, "wb");
if (f == NULL) {
ESP_LOGE("file test", "Failed to open file for writing");
return;
}
比如这样总是打开失败,但如果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


Who is online

Users browsing this forum: No registered users and 1 guest