Go Down

Topic: String Concatenation ? [solved] (Read 2 times) previous topic - next topic

mrbbp

Mar 03, 2006, 04:34 pm Last Edit: Mar 03, 2006, 11:58 pm by mrbbp Reason: 1
Massimo,

you've said in a previous thread that string operation are allowed in Arduino...
I've tried a printf() like this but it doesn't work !:-/
the compilator doesn't generate error !

What i'm doing wrong ?

Code: [Select]
printStringLCD(printf("Poeme %d ligne 1", Poeme));

i suppose this is very simple but i'm newb in C.
i just want to concatene a string with an integer variable !

regards

mrbbp

mrbbp

I've tried with an sprintf()

Code: [Select]
 sprintf(combo,"%s%d%s", "Poeme ", Poeme, "ligne 1");
  printStringLCD(combo);  


No error but doesn't work anymore.
Nothing on LCD and Arduino led on pin13 Blink (on each main loop i suppose)
 ???

mrbbp

;D
I've found...
Code: [Select]
strcat(str1,str2);// append str2 to str1
// if str2 is an integer, have to convert it to string before append.
itoa(int2, str2, 10); // 10 is the radix


hope this'll help. and i'm not saying wrongs things
it's work for me::)

mrbbp

Go Up