Hello! I am trying to use sprintf, but get no result (C51, version 5.20).
char xdata command [80], i=100; strcpy (command, "Hello!"); // now command contains "Hello!" sprintf (command, "Test %d", i); // command has not changed
The variable i is defined as a char (1 byte). sprintf "%d" expects an integer (2 bytes). Try casting it usually works for me, and use the b to say its a byte. sprintf(command, "%bd", (char)i);
char i; : sprintf(command, "%bd", (char)i);
sprintf(command, "%bd", i);
sprintf(command, "%d", (int)i);