Fatfs R0.13b 版本官方源码


最新Fatfs 官方源码,亲测可用,已移植至STM32。需要的可以下载。
资源截图
代码片段和文件信息
/*------------------------------------------------------------/
/ Open or create a file in append mode
/ (This function was sperseded by FA_OPEN_APPEND flag at FatFs R0.12a)
/------------------------------------------------------------*/

FRESULT open_append (
    FIL* fp            /* [OUT] File object to create */
    const char* path    /* [IN]  File name to be opened */

{
    FRESULT fr;

    /* Opens an existing file. If not exist creates a new file. */
    fr = f_open(fp path FA_WRITE | FA_OPEN_ALWAYS);
    if (fr == FR_OK) {
        /* Seek to end of the file to append data */
        fr = f_lseek(fp f_size(fp));
        if (fr != FR_OK)
            f_close(fp);
    }
    return fr;
}


int main (void)
{
    FRESULT fr;
    FATFS fs;
    FIL fil;

    /* Open or create a log file and ready to append */
    f_mount(&fs ““ 0);
    fr = open_append(&fil “logfile.txt“);
    if (fr != FR_OK) return 1;

    /* Append a line */
    f_printf(&fil “%02u/%02u/%u %2u:%02u
“ Mday Mon Year Hour Min);

    /* Close the file */
    f_close(&fil);

    return 0;
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        8501  2018-04-07 17:45  documents0index_e.html
     目录           0  2018-07-22 10:30  documentsdoc
     文件        3139  2018-04-07 17:45  documentsdocchdir.html
     文件        2207  2018-04-07 17:45  documentsdocchdrive.html
     文件        3023  2018-04-07 17:45  documentsdocchmod.html
     文件        2148  2018-04-07 17:45  documentsdocclose.html
     文件        2004  2018-04-07 17:45  documentsdocclosedir.html
     文件       19332  2018-07-22 10:26  documentsdocconfig.html
     文件        1817  2018-04-07 17:45  documentsdocdinit.html
     文件        7628  2018-04-07 17:45  documentsdocdioctl.html
     文件        3763  2018-04-07 17:45  documentsdocdread.html
     文件        2273  2018-04-07 17:45  documentsdocdstat.html
     文件        3493  2018-04-07 17:45  documentsdocdwrite.html
     文件        1706  2018-04-07 17:45  documentsdoceof.html
     文件        1595  2018-04-07 17:45  documentsdocerror.html
     文件        5294  2018-08-05 19:22  documentsdocexpand.html
     文件        1725  2018-04-07 17:45  documentsdocfattime.html
     文件        4303  2018-04-07 17:45  documentsdocfdisk.html
     文件       10494  2018-04-07 17:45  documentsdocfilename.html
     文件        5312  2018-04-07 17:45  documentsdocfindfirst.html
     文件        2547  2018-04-07 17:45  documentsdocfindnext.html
     文件        5476  2018-04-07 17:45  documentsdocforward.html
     文件        2673  2018-04-07 17:45  documentsdocgetcwd.html
     文件        3481  2018-04-07 17:45  documentsdocgetfree.html
     文件        3103  2018-04-07 17:45  documentsdocgetlabel.html
     文件        3076  2018-04-07 17:45  documentsdocgets.html
     文件        7321  2018-04-07 17:45  documentsdoclseek.html
     文件        2370  2018-04-07 17:45  documentsdocmkdir.html
     文件        7870  2018-04-07 17:45  documentsdocmkfs.html
     文件        5602  2018-04-07 17:45  documentsdocmount.html
     文件        7707  2018-04-07 17:45  documentsdocopen.html
............此处省略60个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)