El Viernes, 13 de Abril de 2007, Simon Baxter escribió:
My question is this. I need to modify the channel sent, so that double (or triple) channel numbers are sent as '6 3' or '1 1 7' rather than '63' or '117'. i.e. put spaces between the letters.
You can try something like that:
char txt2[strlen(txt) * 2]; int i = 0; int j = 0; while (i < strlen(txt) - 1) { txt2[j] = txt[i]; i++; j++; txt2[j] = ' '; j++; } txt2[j] = txt[i]; j++; txt2[j] = '\0';
Thanks!
One more thing - how do I convert a %d variable to a %s string first?
My 'txt' variable is currently an integer.