FAT questions

Looking for feedback about FAT:

  1. What is the difference between the FS2 and FAT filesystems?

  2. I need to write binary data to a FAT file, but there doesn�t appear to be specific functions which support binary data. Going off a forum post I saw, I am doing something like the following. Is this the appropriate way to write binary data to a FAT file?

long time;
time = MS_TIMER;
rc = fat_Write(&my_file, (char *)&time, sizeof(long));

Thank you very much for your help,

John Wilson

The FS2 file system is a very simple flat file system, which means it does not support the concept of directories, only a list of files. The FAT filesystem allows directory structures to be built and incorporates a battery-backed cache layer that reduces the number of writes to the flash device, especially for sequential logging type applications.

Your example is correct, assuming you had already properly initialized the file system and opened the file. This would write the 4 byte binary value of time to the file given. The FAT file system makes no distinction between ASCII or binary, to it, everything is just data.


Great - thank you!