Go Down

Topic: SdFat long file name length limit is 255 chars including extension (Read 124 times) previous topic - next topic

OMOTS

Mr. Greiman's very useful response at https://forum.arduino.cc/index.php?topic=171663.0 includes code for reading long file names. I noticed that the posted code limits LFNs to 130 chars, rather than the FAT limit of 255. I wondered if 130 chars is the actual LFN length limit in SdFat, so I created a file named "myPQwhWmtAAkyLZLjVUAjDayPDfYXfGjecYfbdMvTsTPJPputddhsiyJvmLgBLEEPVRYWVQidnSgkAeafWyNdgLBNpnBgiuWTNybxwUQmsVESXMLBVLPvNnQYocBmCrQyeBvMPRXmmWKjiVBszcMccvQBETAfiLQEowHguWSjexCKBNQFAKoUFHrdFQmvSVwwfiLzJfvATnTrFEdnwYBNszuChFZCfxtQNKgnaWkcwbdKFkV.txt" (255 chars with '.txt") in the root directory of an SD card, increased the LFN array size & associated constants to 256 and ran Mr. Greiman's code.

When it came to my grotesquely long file name, the program returned the entire 255 char file name.

Thought I'd post this for the benefit of anyone else with the same question regarding the use of Mr. Greiman's excellent SD card libraries.

Incidentally, I turned Mr. Greiman's code from the referenced post into a subroutine with comments explaining my understanding of what the code does. It's attached.

Go Up