Hello,
I frustred to be blocked with that.
I can nit copy a string to a char
I declare spliedString like this
// SlitString
#define NBVALS 9
char *splitedString[NBVALS];
I have that function
splitString("toto,+345,titi",slitedString)
void splitString(char *ligne, char **splitedString)
{
char *p = ligne;
int i = 0;
splitedString[i++] = p;
while (*p) {
if (*p==',') {
*p++ = '\0';
if (i<NBVALS){
splitedString[i++] = p;
}
}
else
{
p++;
}
}
while(i<NBVALS){
splitedString[i++] = p;
}
}
If I do a for with splitedString display, it display this
for(int i=0;i<4;i++){
Serialprint(i);Serial.print(":");Serial.println(splitedString[i]);
}
//0:toto
//1:+4176112233
//2:14/09/19
I also declared and want to copy..
char sms_who[15];
char sms_phone_number[15];
char sms_data[15];
//and I want to copy
strcpy(sms_who,splitedString[0])
strcpy(sms_phone_number,splitedString[1])
strcpy(sms_date,splitedString[2]
)
This generate an error message
strcpy(sms_who,splitedString[0])
sim908_cooking:840: error: invalid conversion from 'char' to 'char*'
while splitedString[0] contain 'toto' and tot is a string in a char?
I know, I am very confused with char and pointer * :o(