Simple way to read in csv data

I wanted to post this against this topic: https://forum.arduino.cc/index.php?topic=340849.0 buhttps://forum.at it’s too old for new replies, so I thought I’d post it here.

This reads in a known number of csv values, all strings. The readStringUntil function is quite handy for this sort of thing.

      char record[15];  //longest file name
      for (int i=0; i<FileNo; i++){
      strcpy(record,configFile.readStringUntil(',').c_str());
      Debug.print(DBG_DEBUG, "loadLogArray, i:%d. record %s \n", i, record);
      logFiles[i]=record;
      }

Note, I purposely formatted my file so that it would have an ending ‘,’ but it’s easy enough to loop on less time and search for ‘\n’ on the last one.

I am sorry for the question !!! It’s my first project with Arduino.
I use Arduino to send SMS from csv files. where Should I download CSV files before using you function ?
Where should I add this function after download CSV file.??
Thank you

I use this code:

String message = “Message test”;
String numero[2]= {“0000000000"”, “0000000000"”}; // Numéros des destinataires, changer le numéro dans la variable selon le nombre

void setup()
{

Serial.begin(9600); // demande d’activer le port principale
Serial2.begin(9600); // activer le port avec la vitesse 9600

}

void loop() // ca se repete indifiniment
{
for ( int a=0; a<2; a++){ // mettre le même numero qui correspond au numero de la variable dans la quel on a enregistrer les numéros
Serial2.println(“AT”);
delay(1000);
Serial2.print(“AT+CMGF=1\r”); //Activation mode Texte
delay(1000);
Serial2.print(“AT+CMGS=”"); //Numéro du destinataire
Serial2.println(numero[a]);
delay(1000);
//Serial2.print(message);//Message à envoyer
Serial2.write(“Hello”); //2eme methode pour envoyer un message
delay(1000);
Serial2.write((char)26); //Envoi du message
Serial.print(a);
delay(2000);
}

while(1){ // Boucle infinie pour fin d’envoi

}
}

Thanks