FatFs

Started by tha, May 05, 2022, 10:00:40 AM

Previous topic - Next topic

tha

http://elm-chan.org/fsw/ff/doc/stat.html



Parameters
   path
       ตัวชี้ไปยัง the null-terminated string ที่ระบุ the object เพื่อรับข้อมูลของมัน. The object ต้องไม่เป็น the root direcotry.
   fno
       ตัวชี้ไปยัง the blank FILINFO structure เพื่อเก็บ the information of the object. เซ็ต null pointer ถ้าข้อมูลนี้ไม่ถูก
       ต้องการ.

Return Values
FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY, FR_NO_FILE, FR_NO_PATH, FR_INVALID_NAME, FR_INVALID_DRIVE, FR_NOT_ENABLED, FR_NO_FILESYSTEM, FR_TIMEOUT, FR_NOT_ENOUGH_CORE

Description
The f_stat function ตรวจสอบการมีอยู่ของ a file or sub-directory ใน the directory. ถ้ามันไม่มีอยู่, the function ส่งคืนกลับด้วย FR_NO_FILE. ถ้ามันมีอยู่, the function ส่งคืนกลับด้วย FR_OK และ the informations เกี่ยวกับ the object, size, timestamp and attribute, ถูกเก็บไปยัง the file information structure. สำหรับรายละเอียดของ the file information, ดูที่ the FILINFO structure และ f_readdir function.
โปรดทราบว่าข้อมูลไฟล์มาจากข้อมูลเมตาในไดเร็กทอรี หากไฟล์ถูกเปิดและแก้ไขแล้ว ไฟล์จะจำเป็นต้องซิงค์หรือปิดเพื่อรับข้อมูลไฟล์ล่าสุด

QuickInfo
มีให้ใช้งานเมื่อ FF_FS_MINIMIZE == 0.

Example
(ตัวอย่างโค้ดดูในลิ้งค์เอานะครับ)

References
f_opendir, f_readdir, FILINFO

tha

http://elm-chan.org/fsw/ff/doc/unlink.html



Parameter
   path
       ตัวชี้ไปยัง a null-terminated string ที่ระบุ the file or sub-directory ที่จะถูกเอาออก.

Return Values
FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY, FR_NO_FILE, FR_NO_PATH, FR_INVALID_NAME, FR_DENIED, FR_WRITE_PROTECTED, FR_INVALID_DRIVE, FR_NOT_ENABLED, FR_NO_FILESYSTEM, FR_TIMEOUT, FR_LOCKED, FR_NOT_ENOUGH_CORE

Description
หากเงื่อนไขของ the object ที่จะถูกลบมีผลกับเงื่อนไขต่อไปนี้ ฟังก์ชันจะถูกปฏิเสธ.
  •  The file/sub-directory ต้องไม่มี read-only attribute (AM_RDO), มิฉะนั้น the function จะถูกปฏิเสธด้วย FR_DENIED.
  •  The sub-directory ต้องว่างเปล่าและต้องไม่เป็น current directory, มิฉะนั้น the function จะถูกปฏิเสธด้วย FR_DENIED.
  •  The file/sub-directory ต้องไม่ถูกเปิด, มิฉะนั้น the FAT volume สามารถถูกยุบได้. มันจะถูกปฏิเสธอย่างปลอดภัยเมื่อ file lock
      function ถูกเปิดใช้งาน.

QuickInfo
มีให้ใช้งานเมื่อ FF_FS_READONLY == 0 and FF_FS_MINIMIZE == 0.

tha

http://elm-chan.org/fsw/ff/doc/rename.html



Parameters
   old_name
       ตัวชี้ไปยัง a null-terminated string ที่ระบุ the existing file or sub-directory ที่จะถูกเปลี่ยนชื่อ.
   new_name
       ตัวชี้ไปยัง a null-terminated string ที่ระบุ the new object name. A drive number อาจถูกระบุใน string นี้แต่มันจะถูกเพิก
       เฉยและทึกทักเอาว่าเป็น the same drive ของ the old_name. object ใดๆที่มี path name นี้ยกเว้น old_name จะต้องไม่มีอยู่,
       มิฉะนั้น the function จะล้มเหลวด้วย FR_EXIST.

Return Values
FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY, FR_NO_FILE, FR_NO_PATH, FR_INVALID_NAME, FR_EXIST, FR_WRITE_PROTECTED, FR_INVALID_DRIVE, FR_NOT_ENABLED, FR_NO_FILESYSTEM, FR_TIMEOUT, FR_LOCKED, FR_NOT_ENOUGH_CORE

Description
เปลี่ยนชื่อ a file or sub-directory และสามารถย้ายมันไปยัง directory อื่นใน the same volume ได้อีกด้วย. The object ที่จะถูกเปลี่ยนชื่อต้องไม่เป็น an open object, มิฉะนั้น the FAT volume สามารถถูกยุบได้. the wrong operation ดังกล่าวจะถูกปฏิเสธอย่างปลอดภัยเมื่อ file lock function ถูกเปิดใช้งาน.

QuickInfo
มีให้ใช้งานเมื่อ FF_FS_READONLY == 0 and FF_FS_MINIMIZE == 0.

Example


tha

http://elm-chan.org/fsw/ff/doc/chmod.html



Parameters
   path
       ตัวชี้ไปยัง the null-terminated string ที่ระบุ an object ที่จะถูกเปลี่ยน
   attr
       Attribute flags ที่จะถูกเซ็ตในการรวมกันตั้งแต่หนึ่งขึ้นไปของ flags ต่อไปนี้. The specified flags จะถูกเซ็ตและแฟล็กอื่นๆ จะถูก
       เคลียร์.
   mask
       Attribute mask ที่ระบุว่า attribute ใดจะถูกเปลี่ยน. The specified attributes จะถูกเซ็ตหรือถูกเคลียร์และตัวอื่นๆถูกทิ้งไว้ไม่
       เปลี่ยน.

Return Values
FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY, FR_NO_FILE, FR_NO_PATH, FR_INVALID_NAME, FR_WRITE_PROTECTED, FR_INVALID_DRIVE, FR_NOT_ENABLED, FR_NO_FILESYSTEM, FR_TIMEOUT, FR_NOT_ENOUGH_CORE

Description
The f_chmod function เปลี่ยน the attribute of a file or sub-directory.

QuickInfo
มีให้ใช้งานเมื่อ FF_FS_READONLY == 0 and FF_USE_CHMOD == 1.

Example

tha

http://elm-chan.org/fsw/ff/doc/utime.html



Parameters
   path
       ตัวชี้ไปยัง the null-terminated string ที่ระบุ an object ที่จะถูกเปลี่ยน
   fno
      ตัวชี้ไปยัง the file information structure ที่มี a timestamp ที่จะถูกเซ็ตใน member fdate and ftime. ไม่สนใจ members
      อื่นใดๆ.

Return Values
FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY, FR_NO_FILE, FR_NO_PATH, FR_INVALID_NAME, FR_WRITE_PROTECTED, FR_INVALID_DRIVE, FR_NOT_ENABLED, FR_NO_FILESYSTEM, FR_TIMEOUT, FR_NOT_ENOUGH_CORE

Description
The f_utime function เปลี่ยน the timestamp of a file or sub-directory

Example


QuickInfo
มีให้ใช้งานเมื่อ FF_FS_READONLY == 0 and FF_USE_CHMOD == 1.

See Also
f_stat, FILINFO

tha

http://elm-chan.org/fsw/ff/doc/mkdir.html



Parameter
   path
       ตัวชี้ไปยัง the null-terminated string ที่ระบุ the directory name ที่จะสร้าง.

Return Value
FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY, FR_NO_PATH, FR_INVALID_NAME, FR_DENIED, FR_EXIST, FR_WRITE_PROTECTED, FR_INVALID_DRIVE, FR_NOT_ENABLED, FR_NO_FILESYSTEM, FR_TIMEOUT, FR_NOT_ENOUGH_CORE

Description
This function สร้าง a new directory. เพื่อลบ a directory, ใช้ f_unlink function.

QuickInfo
มีให้ใช้งานเมื่อ FF_FS_READONLY == 0 and FF_FS_MINIMIZE == 0.

Example

tha

http://elm-chan.org/fsw/ff/doc/chdir.html



Parameters
   path
       ตัวชี้ไปยัง the null-terminated string ที่ระบุ the directory ที่จะถูกเซ็ตเป็น current directory.

Return Values
FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY, FR_NO_PATH, FR_INVALID_NAME, FR_INVALID_DRIVE, FR_NOT_ENABLED, FR_NO_FILESYSTEM, FR_TIMEOUT, FR_NOT_ENOUGH_CORE

Description
The f_chdir function เปลี่ยน the current directory of the logical drive. นอกจากนี้ the current drive จะถูกเปลี่ยนเมื่ออยู่ใน Unix style drive prefix, FF_STR_VOLUME_ID == 2. The current directory ของแต่ละ logical drive ถูกเตรียมข้อมูลเบื้องต้นให้กับ the root directory บน(ตอน) mount.
โปรดทราบว่า the current directory ถูกรักษาไว้ใน the each file system object และ the current drive ถูกรักษาไว้ใน a static variable, ดังนั้นมันยังมีผลต่องานอื่นๆที่ใช้ the file functions ด้วย.

QuickInfo
มีให้ใช้งานเมื่อ FF_FS_RPATH >= 1.

Example


See Also
f_chdrive, f_getcwd

tha

http://elm-chan.org/fsw/ff/doc/chdrive.html



Parameters
   path
       ระบุ the logical drive number ที่จะถูกเซ็ตเป็น the current drive.

Return Values
FR_OK, FR_INVALID_DRIVE

Description
The f_chdrive function เปลี่ยนเฉพาะ the current drive. The initial value of the current drive number คือ 0. ใน Unix style drive prefix configuration, ฟังชั่นนี้จะไม่ถูกต้องการเพราะ f_chdir function เปลี่ยน the current drive ด้วย. โปรดทราบว่า the current drive ถูกรักษาไว้ใน a static variable, ดังนั้นมันยังมีผลต่องานอื่นๆที่ใช้ the file functions.

QuickInfo
มีให้ใช้งานเมื่อ FF_FS_RPATH >= 1.

Example


See Also
f_chdir, f_getcwd