FATFS里的FILINFO结构体详解
生活随笔
收集整理的這篇文章主要介紹了
FATFS里的FILINFO结构体详解
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
當(dāng)調(diào)用FatFS中的f_readdir函數(shù)返回FILINFO值的時(shí)候,大家如果直接看FILINFO里面的值可能看不懂。因?yàn)槔锩娴闹敌枰蠹肄D(zhuǎn)換一下,FILINFO的具體格式如下:
/* File information structure (FILINFO) */typedef struct {FSIZE_t fsize; /* File size */WORD fdate; /* Modified date */WORD ftime; /* Modified time */BYTE fattrib; /* File attribute */ #if FF_USE_LFNTCHAR altname[FF_SFN_BUF + 1];/* Altenative file name */TCHAR fname[FF_LFN_BUF + 1]; /* Primary file name */ #elseTCHAR fname[12 + 1]; /* File name */ #endif } FILINFO;The FILINFO structure holds a file information returned by f_stat and f_readdir function.
typedef struct {DWORD fsize; /* File size */WORD fdate; /* Last modified date */WORD ftime; /* Last modified time */BYTE fattrib; /* Attribute */TCHAR fname[13]; /* Short file name (8.3 format) */ #if _USE_LFNTCHAR* lfname; /* Pointer to the LFN buffer */int lfsize; /* Size of the LFN buffer in unit of TCHAR */ #endif } FILINFO;Members
fsize:Indicates size of the file in unit of byte. Always zero for directories.
fdate:Indicates the date that the file was modified or the directory was created.
????????????bit15:9
????????????????Year origin from 1980 (0..127)
????????????bit8:5
????????????????Month (1..12)
????????????bit4:0
????????????????Day (1..31)
ftime:Indicates the time that the file was modified or the directory was created.
????????????bit15:11
????????????????Hour (0..23)
????????????bit10:5
????????????????Minute (0..59)
????????????bit4:0
????????????????Second / 2 (0..29)
/* File information structure (FILINFO) */typedef struct {FSIZE_t fsize; /* File size */WORD fdate; /* Modified date */WORD ftime; /* Modified time */BYTE fattrib; /* File attribute */ #if FF_USE_LFNTCHAR altname[FF_SFN_BUF + 1];/* Altenative file name */TCHAR fname[FF_LFN_BUF + 1]; /* Primary file name */ #elseTCHAR fname[12 + 1]; /* File name */ #endif } FILINFO;The FILINFO structure holds a file information returned by f_stat and f_readdir function.
typedef struct {DWORD fsize; /* File size */WORD fdate; /* Last modified date */WORD ftime; /* Last modified time */BYTE fattrib; /* Attribute */TCHAR fname[13]; /* Short file name (8.3 format) */ #if _USE_LFNTCHAR* lfname; /* Pointer to the LFN buffer */int lfsize; /* Size of the LFN buffer in unit of TCHAR */ #endif } FILINFO;Members
fsize:Indicates size of the file in unit of byte. Always zero for directories.
fdate:Indicates the date that the file was modified or the directory was created.
????????????bit15:9
????????????????Year origin from 1980 (0..127)
????????????bit8:5
????????????????Month (1..12)
????????????bit4:0
????????????????Day (1..31)
ftime:Indicates the time that the file was modified or the directory was created.
????????????bit15:11
????????????????Hour (0..23)
????????????bit10:5
????????????????Minute (0..59)
????????????bit4:0
????????????????Second / 2 (0..29)
fattrib:Indicates the file/directory attribute in combination of AM_DIR, AM_RDO, AM_HID, AM_SYS and ????????????????AM_ARC.
fname[]:Indicates the file/directory name in 8.3 format null-terminated string. It is always returnd with upper ? ? ? ? ? case on ?non-LFN configuration but it can be returned with lower case on LFN configuration.
lfname:Pointer to the LFN buffer to store the read LFN. This member must be initialized by application prior ? ? ? ? ?to use this str ucture. Not available on non-LFN configuration.
總結(jié)
以上是生活随笔為你收集整理的FATFS里的FILINFO结构体详解的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Fatfs文件系所有函数总结
- 下一篇: FATFS文件系统框架及源码分析