Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 6 months ago.
how many files can I make and store in local file?
I am storing uint_8 values in each file.
Question relating to:
1 Answer
7 years, 6 months ago.
The max files will be determined by the file system used, I believe localfilesystem is FAT32 which puts the limit slightly over 4 billion files. In other words you'll run out of disk space first.
You want to put a single uint8_t per file? Keep in mind that each file will have an overhead, each file will end up using a few k of disk space whether it contains 1 byte or 1000. Also while you aren't going to run out of files there will be performance hits associated with having lots of files.
Generally it's a lot more efficient to have one large file that holds multiple values in a structured way rather than putting one value in each file and using the file names to provide the structure.
How can I create a file that holds multiple values in a structured way and read them.
posted by 11 May 2017If you are sorting them as binary then define a struct with all the required values and read/write that to the file. If you are storing them as text then either one value per line in a known order or name,value on each line and search through the file until you hit the name you want.
posted by 11 May 2017