This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
程序主要部分如下:
#include <stdio.h>
#include <msp430g2553.h>
float input_voltage = 0;
char str_show[10];
sprintf(str_show,"%-04.3f",input_voltage);
input_voltage的值是正确变动的
sprintf运行后对str_show的值不产生效果
是ccs中不支持sprintf么
您好!
与您选择的printf run-time运行库有关系。如下设置库,选择full。然后再试试看。
下面这一段是选自《MSP430 Optimizing C/C++ Compiler v 4.1 User's Guide》http://www.ti.com/lit/ug/slau132g/slau132g.pdf
是关于printf库的支持情况。
--printf_support={full| Enables support for smaller, limited versions of the printf and sprintf
nofloat|minimal} run-time-support functions. The valid values are:
• full: Supports all format specifiers. This is the default.
• nofloat: Excludes support for printing and scanning floating-point
values. Supports all format specifiers except %f, %F, %g, %G, %e,
and %E.
• minimal: Supports the printing and scanning of integer, char, or
string values without width or precision flags. Specifically, only
the %%, %d, %o, %c, %s, and %x format specifiers are supported
There is no run-time error checking to detect if a format specifier is
used for which support is not included. The --printf_support option
precedes the --run_linker option, and must be used when performing
the final link.