Hello, i've got some prob with the C++ string functions
my code worked well in arduino003 now, i've got an error
error invalid conversion from 'const char*' to 'char'
i think i understand what it mean but i don't know how to resolve the prob.
is it about my string copy ?
and how to modify the char type
// init poeme
int jour = 0;
int nJour = 17;
int mois = 2;
int an = 2;
char chaine[65] = " ";
char ligne[0x10] = "";
int jMax[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
const char *sJour[33] = {"", " premier", " deux", " trois", " quatre", " cinq", " six", " sept", " huit", " neuf", " dix", " onze", " douze", " treize", " quatorze", " quinze", " seize", " dix-sept", " dix-huit", " dix-neuf", " vingt", " vingt-et-un", " vingt-deux", " vingt-trois", " vingt-quatre", " vingt-cinq", " vingt-six", " vingt-sept", " vingt-huit", " vingt-neuf", " trente", " trente-et-un", " mille"};
const char *sMois[13] = {"", " janvier", " fevrier", " mars", " avril", " mai", " juin", " juillet", " aout", " septembre", " octobre", " novembre", " decembre"};
const char *sAnnee[8] = {"", ""," deux mille deux", " deux mille trois", " deux mille quatre", " deux mille cinq", " deux mille six"};
const char *sNomJour[7] = {"dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"};
void setup (void) {
Serial.begin(115200);
delay(100);
}
void loop (void) {
int i = 0;
int j = 0;
if (jour > 6) {jour = 0;}
if (nJour > jMax[mois]) {nJour = 1; mois++;}
if (mois == 2 && an == 3) { jMax[2] = 29;} else { jMax[2] = 28;}
if (mois > 12) {mois = 1; an++;}
// concatenation des chaines
*chaine = " ";
strcpy(chaine, sNomJour[jour]); // dimanche
strcat(chaine, sJour[nJour]); // dix-sept
strcat(chaine, sMois[mois]); // Février
strcat(chaine, sJour[2]); // deux
strcat(chaine, sJour[32]);// mille
strcat(chaine, sJour[an]); // deux
Serial.print(chaine);
jour++;
nJour++;
// ecriture des lignes
strncpy(ligne,chaine,16);
if (strlen(ligne) >= 16) {
ligne[16] = '\0';
}
// ecrit la ligne
Serial.print(ligne);
delay(100);
*ligne=" ";
for (i=2; i<=4;i++) {
strncpy(ligne,&chaine[16*(i-1)],16);
if (strlen(ligne) >= 16) {
ligne[16] = '\0';
}
// ecrit la ligne
Serial.print(ligne);
delay(100);
*ligne=" ";
}
}
i was just trying to understand a bit C, now it is C++
any solution or a begin of solution ?
regards
eric