0

我想知道,在使用f_mkdir()功能后,我正在创建“SENT”文件夹,但在该文件夹中,又创建了一个没有任何描述的“SENT”文件/文件夹。

iFResult = f_stat("/SENT" ,&File_Info);     // Check "SENT" folder is 
// present or not, if not present then create it.    
if(iFResult > FR_OK)
{
    iFResult = f_mkdir("/SENT");    //  Create a new directory 
}

我无法理解问题出在我的代码上。任何帮助表示赞赏。

快照

[fatfs:通用 FAT 文件系统模块]

4

1 回答 1

1

if(iFResult > FR_OK)似乎错了。根据文档,您必须测试:

if (iFresult == FR_NO_FILE) {
    // file or subdir does not exist
}
else if (iFresult != FR_OK) {
    // error
}
else // file/subdir exists
于 2018-01-02T16:09:54.443 回答