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
  • Thanks for your reply:
    I'm not in control of where and on what machine the SD card might be read. So I would like to store it in a case that is predicable and prefer lower case.
    As far as I know the FAT spec says it must "preserve" case but is not case sensitive. That means if I want to create a file in lowercase it should not mess with the case.

    I think I've discovered a bug and would like to know from Keil what fix they would suggest.

Reply
  • Thanks for your reply:
    I'm not in control of where and on what machine the SD card might be read. So I would like to store it in a case that is predicable and prefer lower case.
    As far as I know the FAT spec says it must "preserve" case but is not case sensitive. That means if I want to create a file in lowercase it should not mess with the case.

    I think I've discovered a bug and would like to know from Keil what fix they would suggest.

Children
  • 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.

  • Thanks for the info.

    Although I accept that all file names will be uppercase I still find it curous that the moment you do a strcat on a filename before creating it, it creates the file using lowercase.

  • I haven't access to the file system - and to my knowledge, the manual is only available with the license.

    Anyway - when using VFAG and long file names, then the FAT file system will preserve case (but still be case-insensitive for name matches). So if the Keil implementation support long file names, then your concatenation will no longer represent a 8.3 name, and the exact name will be used.