cancel
Showing results for 
Search instead for 
Did you mean: 

Resize string variable

Schamann
Associate II

Hi i have this code:

 

char string[6]="Hello";

char string1[6]="World";

 

touchgfx::Unicode::UnicodeChar dst[6];

touchgfx::Unicode::UnicodeChar dst1[6];

touchgfx::Unicode::UnicodeChar txtAreaBuffer1[100];

 

Unicode::strncpy(dst, string, 6);

Unicode::strncpy(dst1, string1, 6);

 

Unicode::snprintf(txtAreaBuffer1, 100, "%s", dst, dst1);

 

Unicode::strncpy(txtAreaBuffer, txtAreaBuffer1, 100);

txtArea.invalidate();

 

Why i have output only Hello instead HelloWorld?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

Unicode::snprintf(txtAreaBuffer1, 100, "%s %s", dst, dst1);

View solution in original post

3 REPLIES 3
Pavel A.
Evangelist III

Unicode::snprintf(txtAreaBuffer1, 100, "%s %s", dst, dst1);

>>Why i have output only Hello instead HelloWorld?

You format a single string, but pass two parameters

Unicode::snprintf(txtAreaBuffer1, 100, "%s%s", dst, dst1);

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Schamann
Associate II

Ofcourse, my mistake...