Hi all !
I'm trying to create a code that opens different files from an SD card. Depending on the circumstances the file is different, so I'm trying to create a string with the file name that I need. I put a code where I generate two file names (file1.c and file2.c) and I try to open the files with this name from the SD card. The errors that I receive from the compiler are :
error: no matching function for call to 'SDClass::open(String&)'
SD.h:83: note: candidates are: File SDClass::open(const char*, uint8_t)
for (int i =1 ; i<3 ; i++){
file_name = String("file");
file_name += i;
file_name += ".c";
Serial.println(file_name);
File dataFile = SD.open(file_name);
dataFile.close();
}
It has to be something obvious, but I'm new and I can't find a way to solve it.
Many thanks