AndreK
May 28, 2014, 12:18pm
1
I have a line
//char text[21]
//mode[num] is a string array of 10byte long strings.
mode[1] = "0123456789"
mode2[1] ="abcdefghij"
strcpy_P(text, (char*) mode[num]);
so, this fills "text" to be "0123456789"
How can I take append "abcdefghij" so that the resulting char array is "0123456789abcdefghij"
system
May 28, 2014, 12:32pm
2
The usual way is to use strcat(). I don't know if there is a strcat_P() function. If not, brute force is called for.
There were a couple of hiccups in your code, but try something like:
char mode[21] = "0123456789";
char mode2[11] ="abcdefghij";
strcat(mode, mode2);
Thank you - decided to load both in RAM, then strcat.
system
May 29, 2014, 11:32am
5
// THIS WORKS O.K.
But pisses away resources uselessly. The thing on the other end of the serial port can't tell that you pissed away a bunch of memory unnecessarily so you could use one Serial.print() statement instead of 13.