Pages: [1]   Go Down
Author Topic: String Concatenation ? [solved]  (Read 2273 times)
0 Members and 1 Guest are viewing this topic.
Britanny
Offline Offline
Full Member
***
Karma: 0
Posts: 233
Mais vrai, j'ai trop pleuré, toute lune est atroce
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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
« Last Edit: March 03, 2006, 05:58:49 pm by mrbbp » Logged

Britanny
Offline Offline
Full Member
***
Karma: 0
Posts: 233
Mais vrai, j'ai trop pleuré, toute lune est atroce
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've tried with an sprintf()

Code:
 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)
???
Logged

Britanny
Offline Offline
Full Member
***
Karma: 0
Posts: 233
Mais vrai, j'ai trop pleuré, toute lune est atroce
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

 ;D
I've found...
Code:
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:smiley

mrbbp
Logged

Pages: [1]   Go Up
Jump to: