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.
工具/软件:Code Composer Studio
尊敬的先生/女士:
我正在尝试打印 类型为 unsigned long long (uint64_t)的数据。 但是、即使我更改数据、它也会打印一些随机常量值。 我已使用%d、%ld、LLD 和%llu 进行打印,但这些 都不起作用。 因此,请告诉我如何使用 System_printf() 和 System_flush()打印 unsigned long long (uint64_t )类型的数据。
您好!
我尝试了以下操作
System_printf ("数据读取为:-%d\n",RDATA);
system_flush();
System_printf ("数据读取为:-%ld,RDATA);
system_flush();
system_printf("数据读取为-%llu\n", RDATA );
system_flush();
此致、
Digvijay
[引用 user="Digvijay khambe">因此,请告诉我如何使用 System_printf() 和 System_flush()打印 unsigned long long 类型的数据(uint64_t )。 System_printf 记录为:
[引用]此函数的行为与 ANSI C 标准 printf 非常相似、但不支持 C 标准指定的全范围格式字符串。系统_printf 不支持 ll (long long)长度修饰符。
解决方法是使用 sprintf 样式函数来设置具有64位值的字符串的格式、然后该字符串将 strinf 与 System_printf 输出。 例如、在针对 Cortex A15的 SYS/BIOS 项目中使用的以下代码:
Bits64 TOTAL_Rx_Bytes = 0; Bits64 TOTAL_TX_Bytes = 0; char summary_text[128]; snprintf (summary_text、sizeof (summary_text)、 "tcpWorker stop clientfd=0x%x errno=%d total_rx_bytes=%llu total_tx_bytes=%llu\n"、 clientfd、fdError ()、total_rx_Bytes、total_tx_Bytes); System_printf ("%s"、summary_text); System_flush ();