Fatlib is a C library manipulating DOS floppy images containing FAT filesystem. It compiles currently under Linux, and possibly BSD.
- FAT12 and FAT16; FAT32 is incomplete,
- long names (VFAT).
Not tested well, esp. FAT32.
Most functions return -1 or NULL on error and set errno.
Disk image is represented by opaque DRIVE* type returned by an open function and supplied as argument to other functions.
DRIVE *fat_open_image(const char *path, int rw)
Fat_dops structure contains user's methods (read, write...) providing image abstraction. They operate on series of bytes not organized in sectors, it is expected that a user will reorganize and buffer disk accesses.
Forward slash (
/) is a separator in paths (Unix convention).
File names use UTF-8.
For file i/o generic FILE* interface is used [stdio.h]. It can be obtained by:
If something has been written to a FILE, it should be explicitly fclosed on exit to ensure that stdio buffers are flushed.
Directory operations use FDIR* pointer (similar to libc's DIR*):
int fat_readdir(FDIR*, struct fat_dirent*)
See fatlib.h for more...