We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
All work OK (compiled and simulated in dScope). But without explicitly typecasting of 'i' you get wrong result
char xdata command [80], i=100; sprintf (command, "Test %d", (int) i); // command has "Test 100" sprintf (command, "Test %d", i); // command has "Test 25600"