參考一下 AN1045 File I/O Functions Using Microchip's Memory Disk Drive File System Library 裡的範例。
This application note covers the usage of file I/O functions using Microchip's memory disk drive file system library. Microchip's memory disk drive file system is based on ISO/IEC 9293 specifications. It is also known as the FAT16 file system, and used on earlier DOS operating systems by Microsoft Corporation. The included source code also supports the FAT32 file system. This is the most popular file system with SD cards, CF cards and USB thumb drives. The applications note code is designed to run on 8-bit PIC18 devices and all 16-bit devices (PIC24F, PIC24H, dsPIC30F, dsPIC33F).