Skip to main content
KiptonM
Senior III
Feb 24, 2021 5:52 PM UTC
Solved

Is sprintf() supposed to support uint64_t numbers?

This compiles with no warnings or errors:

 char buf[256];

uint64_t bignum = 0x123456789;

sprintf(buf,"bignum: 0x%016llx, %llu\r\n",bignum,bignum);

HAL_UART_Transmit_DMA(&huart1,(uint8_t *)buf, strlen(buf));

This comes out the terminal:

bignum: 0x000000000000000lx, lu

%I64d does not compile.

This topic has been closed for replies.
Pavel A.
Pavel A.Best answer
Feb 24, 2021 10:13 PM UTC

Select this:

0693W000007ZPPTQA4.png

5 replies

Uwe Bonnes
Chief
Feb 24, 2021 8:26 PM UTC

It depends on the libc used.

KiptonM
KiptonMAuthor
Senior III
Feb 24, 2021 8:41 PM UTC

Thanks

How do I change the libc in STM32CubeIDE?

And which one should I use?

Where can I find the documentation?

KiptonM
KiptonMAuthor
Senior III
Feb 24, 2021 9:16 PM UTC

googling STM32 libc does not get me anything.

Pavel A.
Pavel A.Best answer
Feb 24, 2021 10:13 PM UTC

Select this:

0693W000007ZPPTQA4.png

KiptonM
KiptonMAuthor
Senior III
Feb 25, 2021 1:36 AM UTC

I got it!

You have to select the project, then File->Properties. To get to that screen.

Thanks, that fixed it.