SD Library - Max files open

Hi Folks.

I was reading about the SD library re opening files for reading and it says that Only one file can be opened at a time. However there is also a mention that Arduino 1.0 can open multiple files.

Cany anyone advise me the truth here. I am liiking at opening 4 files at a time so I can read in different sequences for servo control..

Many thanks Dave

What do you mean with 'arduino 1.0' ? I hope not the IDE, since that doesnt have to do anything with the opening of multiple files.

It depends on the lib, but i haven't seen any lib that can open multiple files at once, i suppose you'll have to do it the 'hard' way and open them one after each other.

opening files has a need to keep pointers to the file object, and i think that if you use multiple pointers it will get mixed up


Ok if you goto this link

there is this passage

The SD library allows for reading from and writing to SD cards, e.g. on the Arduino Ethernet Shield. It is built on sdfatlib by William Greiman. The library supports FAT16 and FAT32 file systems on standard SD cards and SDHC cards. It uses short 8.3 names for files. The file names passed to the SD library functions can include paths separated by forward-slashes, /, e.g. "directory/filename.txt". Because the working directory is always the root of the SD card, a name refers to the same file whether or not it includes a leading slash (e.g. "/file.txt" is equivalent to "file.txt"). [b]As of version 1.0, the library supports opening multiple files[/b].

This is what I am talking about


THe default SD library is built on top of an old version of the Sdfat library. The SD library limits the number of open files to 1 as far as I can tell. The latest Sdfat library (rather than the old one distributed with sd library) only limits the number of open files basaed on the RAM available. see,51087.0.html for example.

fatlib16 is the author of sdfat. sdfatlib20120719 is the latest version as far as I can tell.