const char Unitstring[]="%_VOL"; char Buffer[1024]; sprintf(Buffer,"Unit: %s",Unitstring);
ends up having "Unit: ERRORVOL" instead of "Unit: %_VOL" in Buffer. I would expect this with
sprintf(Buffer,"Unit: %_VOL"); instead sprintf(Buffer,"Unit: %%_VOL");
sorry, I was wrong, I sent the string using UARTprintf(charstring) (in a STM32 environment), this again interpreted the %. The solution is, to use UARTprintf("%s",charstring), then everything works fine.
Don't follow a link posted by someone who thinks the first parameter to sprintf() in C/C++ is the format string.
Quick question - where do you then put the destination buffer where sprintf() will place the formatted output?