SD card access using variable as filename, file not found

When the code excutes the file is not found making me think that other invisible charters maybe embeded in the "Star array". I have substituted the actual filename "CodesA.txt" and the file is found, so what is the difference infile names variable vs quoted?

char Star[9];

void RunOnce() {
Star[0] = 'C';
Star[1] = 'o';
Star[2] = 'd';
Star[3] = 'e';
Star[4] = 's';
Star[5] = 'A';
Star[6] = '.';
Star[7] = 't';
Star[8] = 'x';
Star[9] = 't';

Once = "99";
Serial.println(Star);
if (!SD.begin(SDpinout)) {

Serial.println ("NOT INITALIZED");
delay(3500);

return;
}
//CONTINUE TO FIND FILE

if (SD.exists(Star)) {

Serial.println("FILE EXISTS");
delay(3500);

}

CodeFile = SD.open(Star, FILE_READ);

if (CodeFile) {
Slen = (CodeFile.read());
CodeFile.close();
Serial.println(Slen);

}

}

Surely you should null terminate the string, otherwise the receiving routine won't know how long the string is and will go through memory until it hits a null.

You declare a nine byte array but initialize ten bytes. Star needs to be eleven bytes long and add the null byte as suggested by countrypaul.

Change to:

  char Star[11];

Add:

  Star[10] = 0;