This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

file system case sensitive

I use Keil's file system on a NXP ARM with SD Card. I want to create filenames in lowercase, but when I initialise a string, e.g. strcpy(file_str, "myfile.dat") and do a fopen() with that name it creates a file using uppercase letters.

By chance I found that if I do a strcat after I initialised the string, e.g. strcat(file_str, "_anything") and then do a fopen() the file is created with lowercase letters.

Can someone explain this and how can I create files using lowercase letters?

Parents
  • I'm not in control of where and on what machine the SD card might be read.

    That has nothing to do with it, really.

    As far as I know the FAT spec says it must "preserve" case but is not case sensitive.

    You know that incorrectly, or at least incompletely. FAT exists in several versions, all of case-insensitive. But it's wrong to assume they all preserve case.

    * The original old FAT-12 or FAT-16 systems didn't preserve case. All file names are actually UPPERCASE on disk, even if the file was created with a lowercase name.

    * With Win95 Microsoft plugged an extension onto these file systems: VFAT. This abuses directory entries marked as "deleted file" to store long names and allows them to be mixed-case. It still has to keep the genuine short 11.3 FAT filename around, though, because that's the only one all implementations of FAT12/FAT16 are actually required to keep alive. This nonsense is what gave the world stupid things like c:\Progra~1\Micros~1\.

    * I never bothered to find out if FAT32 (introduced with Win95 OSR2, a.k.a. Win95b, needed if you want volumes bigger than 2GiB) supports mixed-case names directly, or still via that dreaded VFAT nonsense.

    To cut this long story short: if you really want the name of that file preserved as you created it you have no choice: it has to be short (11.3 format) and UPPERCASE.

Reply
  • I'm not in control of where and on what machine the SD card might be read.

    That has nothing to do with it, really.

    As far as I know the FAT spec says it must "preserve" case but is not case sensitive.

    You know that incorrectly, or at least incompletely. FAT exists in several versions, all of case-insensitive. But it's wrong to assume they all preserve case.

    * The original old FAT-12 or FAT-16 systems didn't preserve case. All file names are actually UPPERCASE on disk, even if the file was created with a lowercase name.

    * With Win95 Microsoft plugged an extension onto these file systems: VFAT. This abuses directory entries marked as "deleted file" to store long names and allows them to be mixed-case. It still has to keep the genuine short 11.3 FAT filename around, though, because that's the only one all implementations of FAT12/FAT16 are actually required to keep alive. This nonsense is what gave the world stupid things like c:\Progra~1\Micros~1\.

    * I never bothered to find out if FAT32 (introduced with Win95 OSR2, a.k.a. Win95b, needed if you want volumes bigger than 2GiB) supports mixed-case names directly, or still via that dreaded VFAT nonsense.

    To cut this long story short: if you really want the name of that file preserved as you created it you have no choice: it has to be short (11.3 format) and UPPERCASE.

Children