SdFatlib scroll through files

Ok here is what I want to do, and maybe I am just not seeing how to do this and its simple, or its going to be a PITA ... I dont know

I want to be able to load X amount of files onto an SD card, pop it in an arduino setup and use a rotary encoder to scroll though the list of files up or down, and when I find the one I want press a button to open it, though how to actually get that list is slipping past me

any suggestions?

There are many variations on the SD library. A link to the one you are using would be most helpful.

The SD library that ships with the Arduino 1.0 version has an example that prints the names of the files on the card to the serial monitor. I'm sure that that could be adapted to suit your needs.

SdFatlib (as in the title) yes its the one that ships with 1.0, and the example uses a LS command, without rewriting the library is there an option?

I'm looking at the example listfiles, in the SD/examples directory. It contains this function:

void printDirectory(File dir, int numTabs) {
   while(true) {
     
     File entry =  dir.openNextFile();
     if (! entry) {
       // no more files
       //Serial.println("**nomorefiles**");
       break;
     }
     for (uint8_t i=0; i<numTabs; i++) {
       Serial.print('\t');
     }
     Serial.print(entry.name());
     if (entry.isDirectory()) {
       Serial.println("/");
       printDirectory(entry, numTabs+1);
     } else {
       // files have sizes, directories do not
       Serial.print("\t\t");
       Serial.println(entry.size(), DEC);
     }
   }
}

I don't see an ls there.

again wrong library but screw it I will just use that one

again wrong library

SdFatlib (as in the title) yes its the one that ships with 1.0, and the example uses a LS command, without rewriting the library is there an option?

SD is the only one that ships with Arduino 1.0. How can it be the wrong library? There is no SdFatlib that ships with 1.0.

OK listen dude I made a mistake I thought they were the same library because the one that ships with arduino is a simplified version of the same freaking library

I have been banging my head against SDFAT darn near all day, that was the most common SD + fat library up until apparently recently, I asked a question and the first response I get "which one"

well its the one in quarter inch tall neon orange letters in the title of the post

so sorry for asking, I wont bother you again

The SD.h library is a wrapper for an old version of SdFat. The purpose of this wrapper is to provide simple a API for SdFat.

Unfortunately the SD.h listfiles example seems to have bugs in 1.0. listfiles is intended to demonstrate the SD.H openNextFile() function to open each file in a directory.

SdFat has a similar example that lists files. The SdFat OpenNext example uses SdFat's openNext() function to list all files in the root directory.

I wrote SdFat but am not involved with the SD.h wrapper or its examples.

ok thank you, I was unsure if openNext() is what I wanted or not, unfamiliar with the library it quickly became overwhelming

and of course the SD.h setup provided with 1.0 doesnt compile on my machine so I just shut everything down and though that I would figure it out later (I have a power pc running linux for my bench machine and kind of sort of stuck with older software, Sdfat lib works like a charm though)