Hi - here's my code:
String fileLoader1 = String(loadChoice);
Serial.println(fileLoader1);
String fileLoader2 = "\"/save" + fileLoader1;
String fileLoader3 = fileLoader2 + ".txt\", \"r\"";
File f = SPIFFS.open(fileLoader3);
if (!f) {
Serial.println("file open failed");
} Serial.println("=======Load Save=======");
All the save files follow the format "save##.txt", and the INT loadChoice contains the ## portion of the filename. I did a print of the fileLoader1 string to make sure the number was coming through, and it was correct.
But I still get "file open failed" - the system works fine if I enter the number manually before uploading, so I'm guessing that the SPIFFS.open(fileLoader3) portion is not being interpreted correctly....but it looks correct to me :\
I'm hoping someone here who's much better with C will see immediately the issue in my process here, any help would be appreciated!
edit: printing fileLoader3 gives me the correct filepath: "/save1.txt", "r"
So I'm guessing that it's just an issue with this function not being able to handle strings?