Wave Shield Adafruit - Play next song and previous song

Hi there !

So I have tried some stuff but I'm still not managing to get my result.

First of all, I had to declare my array out of my setup loop for it to become a global variable. That means that I had to set it to a random number.

Then I manage to put in it the appropriate strings through the save saveEntryName function.

When I Serial.write my result in the saveEntryName function I get the good result, the result I'm excpecting. When I do the exact same print from my setup loop I get empty results.

Here is the code :

int numberOfFiles = 0;
int currentFile = 0;
char* filesList[150];

void setup() {
 Serial.begin(9600);  

 //Wave shield configuration
 card.init();
 card.partialBlockRead(true);
 uint8_t part;
 for (part = 0; part < 5; part++) {   // we have up to 5 slots to look in
   if (vol.init(card, part)) 
     break;                           // we found one, lets bail
 }
 root.openRoot(vol);
 getNumberOfFiles(root);
 root.rewind();
 Serial.print("Good content : ");
 Serial.println();
 getFiles(root);
 
 Serial.print("Bad content : ");
 Serial.println();
 Serial.write("\"");
 Serial.write(filesList[0]);
 Serial.write("\"");
 Serial.println();
 Serial.write("\"");
 Serial.write(filesList[1]);
 Serial.write("\"");
 Serial.println();
 Serial.write("\"");
 Serial.write(filesList[2]);
 Serial.write("\"");

}

void getFiles(FatReader &d) { 
 while (d.readDir(dirBuf) > 0) {  
    
   if (dirBuf.name[0] == '.') continue; 
       
   if (DIR_IS_SUBDIR(dirBuf)) {   
     FatReader s;                
     dirLevel += 2;               
     if (s.open(vol, dirBuf))
     getFiles(s);                    
     dirLevel -=2;               
   } else {      
     saveEntryName(dirBuf);
     currentFile += 1;
   }
 }
}

/**
* Return the entry name
*/
void saveEntryName(dir_t &dir) {
 String entryNameString = "";
 for (uint8_t i = 0; i < 11; i++) {
   if (dir.name[i] == ' ') continue;
   if (i == 8) entryNameString.concat('.');
   char a;
   a = dir.name[i];
   entryNameString.concat(a);
 }
 char entryNameChar[entryNameString.length()+1];
 for (int j = 0; j< entryNameString.length()+1; j++) {
   entryNameChar[j] = entryNameString[j];
 }
 char *entryNamePointer = entryNameChar;
 filesList[currentFile] = entryNamePointer;
 Serial.write("\"");
 Serial.write(filesList[currentFile]);
 Serial.write("\"");
 Serial.println();
}

void getNumberOfFiles(FatReader &d)
{ 
 while (d.readDir(dirBuf) > 0) {     // read the next file in the directory 
   if (dirBuf.name[0] == '.') continue; // skip subdirs . and ..
   if (DIR_IS_SUBDIR(dirBuf)) {   // we will recurse on any direcory
     FatReader s;                 // make a new directory object to hold information
     dirLevel += 2;               // indent 2 spaces for future prints
     if (s.open(vol, dirBuf)) 
     getNumberOfFiles(s);                    // list all the files in this directory now!
     dirLevel -=2;                // remove the extra indentation
   } else {
     numberOfFiles += 1;
   }
 }
}

Here is the result :

Good content :
"INDEXE~1"
"WPSETT~1.DAT"
"TEST.WAV"
Bad content :
""
""
""

Does anybody have an idea ?