硬汉嵌入式论坛

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

[FatFs] 怎么使用文件系统中的f_unlink

[复制链接]

9

主题

24

回帖

51

积分

初级会员

积分
51
发表于 2015-11-20 09:16:45 | 显示全部楼层 |阅读模式
我使用的版本为R0.11 ,在删除文件的时候出现    FR_DISK_ERR,            /* (1) A hard error occurred in the low level disk I/O layer */
这个错误,代码如下:

#define        Del_Path                    "1:/update.config"//删除的路径

fres=f_unlink(Del_Path);//将这个文件删除
if(fres != FR_OK)
{
        printf("Can't f_unlink file,fres=%d \r\n",fres);
    return ;
}
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106934
QQ
发表于 2015-11-20 11:17:44 | 显示全部楼层
返回这个错误的话是底层移植稍有些问题。

=====
另外使用这个函数注意以下三个问题:
    [li]The file/sub-directory must not have read-only attribute (AM_RDO), or the function will be rejected with FR_DENIED.[/li][li]The sub-directory must be empty and must not be current directory, or the function will be rejected with FR_DENIED.[/li][li]The file/sub-directory must not be opened, or the FAT volume can be collapsed. It will be rejected safely when file lock feature is enabled.[/li]

1. 文件或者文件夹属性不能是只读。
2. 如果删除文件夹的话,文件夹必须为空
3. 删除文件或者文件夹的话,文件和文件夹之前不能被打开。
回复

使用道具 举报

9

主题

24

回帖

51

积分

初级会员

积分
51
 楼主| 发表于 2015-12-7 13:49:44 | 显示全部楼层

回 eric2013 的帖子

eric2013:返回这个错误的话是底层移植稍有些问题。

=====
另外使用这个函数注意以下三个问题:
[li]The file/sub-directory must not have read-only attribute (AM_RDO), or the function will be rejected with FR_DENIED.[/li][li]The sub-directory must be empty and must not be cu .. (2015-11-20 11:17) 
好的,谢谢
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-10 18:43 , Processed in 0.160183 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

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