I don't know. I can't think of how to do this. It must be very simple.
I have an integer variable holding some number, say from 1 to 50, that gets incremented with each new message.
Currently, I store a copy of some C-strings combined into a single C-string as an element in an array of C-strings using strcat().
For example, I have
char *msg1 = "this is"
char *msg2 = "a msg"
then I do
strcat(messages[idx], msg1)
strcat(messages[idx], msg2)
so then messages[idx] reads "this is a msg"
But I want to use that integer variable so that the element in 'messages' reads
"i: this is a msg"
where i is the actual value of that integer variable. I see some string to double or integer functions in string.h, and this would all be much easier with a C++ String, but I don't know.. I'm just not finding a way to do this. Any ideas?
I have an integer variable holding some number, say from 1 to 50, that gets incremented with each new message.
Currently, I store a copy of some C-strings combined into a single C-string as an element in an array of C-strings using strcat().
For example, I have
char *msg1 = "this is"
char *msg2 = "a msg"
then I do
strcat(messages[idx], msg1)
strcat(messages[idx], msg2)
so then messages[idx] reads "this is a msg"
But I want to use that integer variable so that the element in 'messages' reads
"i: this is a msg"
where i is the actual value of that integer variable. I see some string to double or integer functions in string.h, and this would all be much easier with a C++ String, but I don't know.. I'm just not finding a way to do this. Any ideas?