|
发表于 2022-10-29 16:55:15
|
显示全部楼层
是否可以:
typedef struct
{
uint8_t ucflag;
uint8_t *ucName;
float ufData;
uint8_t *ucUnit;
}TEXT_T;
TEXT_T test;
char buf[32];
/"对应Urms"/
if(test.ucflag == 1)
{
test.ucName = (uint8_t *)"Urms";
test.ufData = 5.125f;
test.ucUnit = (uint8_t *)"V";
sprintf(buf, "%s, %6.4f, %s", test.ucName, test.ufData, test.ucUnit);
}
else if 省略未写 |
|