Trying to left justify a float using PRINTF("%-4.2f", myfloat); But its not interpreting the -
How is this done?
In the case you are using redlib, you have to remove "CR_INTEGER_PRINTF" define from project settings -> Compiler -> Preprocessor.
The effect should be like this:
float x = 123.456;
printf("++++++++++++++++\n");
printf("%6.2f\n", x);
printf("%9.2f\n", x);
printf("%12.2f\n", x);
printf("%-6.2f\n", x);
printf("%-9.2f\n", x);
printf("%-12.2f\n", x);
Output:
++++++++++++++++
123.46
123.46
123.46
123.46
123.46
123.46
More details on CR_INTEGER_PRINTF can be found on MCUXpresso_IDE_User_Guide.pdf, chapter "16.5.1 Redlib printf Variants", paragraph: "Integer only vs full printf (including floating point)"
Greetings,
MCUXpresso IDE Support
The symbol #PRINTF_ADVANCED_ENABLE needs to be set. That adds support in.