【FatFs】学习笔记 --> FatFs APIs

😊 转载请全文转载,并标明文章出处


  • 操作系统:Window11 企业版
  • IED开发环境:STM32CubeIDE 1.2.0
  • STM32CubeMX版本:STM32CubeMX Version 6.3.0
  • Mcu and Firmware Package:STM32CubeF7 Firmware Package V1.16.2 / 08-December-2021
  • 硬件开发板:STM32F746G-DISCO

FatFs APIs

The set of APIs is divided into four groups:
  • Group of APIs that operates with logical volume or partition (逻辑卷或者分区操作API组).
  • Group of APIs that operates with directory (目录操作API组).
  • Group of APIs that operates with file (文件操作API组).
  • Group of APIs that operates with both file and directory (文件和目录操作API组).
The following list describes what FatFs can do to access the FAT volumes:
  • f_mount(): Register/Unregister a work area (注册/取消注册工作区).
  • f_open(): Open/Create a file (打开/创建文件).
  • f_close(): Close a file (关闭文件).
  • f_read(): Read a file (读文件).
  • f_write(): Write a file(写文件).
  • f_lseek(): Move read/write pointer, Expand a file size (移动读/写指针,扩展文件大小).
  • f_truncate(): Truncate a file size (截断文件大小).
  • f_sync(): Flush cached data (刷新缓存数据).
  • f_opendir(): Open a directory (打开一个目录).
  • f_readdir(): Read a directory item (读取目录项).
  • f_getfree(): Get free clusters (获取可用容量).
  • f_stat(): Check if the object is exist and get status (检查对象是否存在并获取状态).
  • f_mkdir(): Create a directory (创建目录).
  • f_unlink(): Remove a file or directory (删除文件或目录).
  • f_chmod(): Change an attribute (更改属性).
  • f_utime(): Change timestamp (更改时间戳).
  • f_rename(): Rename/Move a file or directory (重命名/移动文件或目录).
  • f_chdir(): Change the current directory (更改当前目录).
  • f_chdrive(): Change the current drive (更改当前驱动器).
  • f_getcwd(): Retrieve the current directory (检索当前目录).
  • f_getlabel(): Get volume label (获取卷标).
  • f_setlabel(): Set volume label (设置卷标).
  • f_forward(): Forward file data to the stream directly (直接将文件数据转移到数据流中).
  • f_mkfs(): Create a file system on the drive (在驱动器上创建文件系统).
  • f_fdisk(): Devide a physical drive (分割物理驱动器).
  • f_gets(): Read a string (读取字符串).
  • f_putc(): Write a character (写一个字).
  • f_puts(): Write a string (写字符串).
  • f_printf(): Write a formatted string (写格式化字符串).
  • f_tell(): Get the current read/write pointer (获取当前读/写指针).
  • f_eof(): Test for end-of-file on a file (测试文件的文件结束符).
  • f_size(): Get the size of a file (获取文件大小).
  • f_error(): Test for an error on a file (测试文件上的错误).