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.

[参考译文] 编译器/TMS570LS0714:我可以使用内置的 vsnprintf()通过 SCI 将格式化的消息打印到超级终端,但它是否支持浮点输出以及宽度或精度?

Guru**** 2457760 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/647147/compiler-tms570ls0714-i-can-print-formatted-message-via-sci-to-hyper-terminal-by-using-built-in-vsnprintf-but-does-it-support-float-output-and-with-width-or-precision

器件型号:TMS570LS0714

工具/软件:TI C/C++编译器

尊敬的所有人

我知道如何使用 printf 函数将消息打印到控制台,这非常有用。  

然后、我提到了以下帖子:    

我成功 地通过 SCI,打印了一些格式化的消息,例如:("%d\r"、123456789) ("%c %s %%o\r" 、"a"、"bcd"、8)  

但我发现当我尝试打印浮点值时、它失败了。 我想这种方法 不支持 宽度或精度的格式化打印、对吗?

我想知道是否有一些改进的技巧,因为我可以将浮点打印到控制台,我不明白为什么 vsnprintf() 失败。

非常感谢。

此致

Leo

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    而且、%x 可以,但%X 失败、然后%08X 再次工作。 奇怪的…
    Leo
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    抱歉。 我的错误,%X 和%08X 都可以正常工作。
    Leo
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    Leo 您好、

    感谢您的分享。 任何其他请求
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    一切都很好。
    谢谢
    Leo