6 years, 10 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:

Rapid Prototyping for general microcontroller applications, USB and 32-bit ARM® Cortex™-M0 based designs

1 Answer

6 years, 10 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.

Accepted Answer

How can I create a file that holds multiple values in a structured way and read them.

posted by jayendra mishra 11 May 2017

If 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 Andy A 11 May 2017

Thank you. Currently, I store them as int and then read them as char and convert to int using ATOI function Is there any example I can follow?

posted by jayendra mishra 15 May 2017

I do this just to save one value

posted by jayendra mishra 15 May 2017