This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

sprintf with a uint64_t variable?

Is there a compiler/makefile flag that allows for 64bit printing?

I have included inttypes.h, and tried both %llu and "PRI64" as shown:

    char scrbuf[30];
    uint64_t time_alive = 12345678;
    uint8_t tempret =0;

	sprintf(scrbuf," "%llu  "",time_alive );
	tempret = sprintf(scrbuf, ""PRIu64"    ",time_alive );

In both cases, the only thing that gets pushed to 'scrbuf' are the values of "l" and "u" to the first and second memory positions. I step through and view each of them in the debugger.

Any insight as to what I may be missing? Some sort of #define or some compiler flag? I am using the BLE HRS example as a base. This is all nrf51_SDK_10.0.0

Related