3

I need to print an unsigned long long variable:

unsigned long long t = 1559072327000ULL;

I have tried the following:

Serial.println(t); // call of overloaded 'println(uint64_t&)' is ambiguous
char[18] buf;
sprintf(dt, 18, "%lu", t); // Prints 4294165848
snprintf(dt, 18, "%lu", t); // Prints 126
vsnprintf(dt, 18, "%lu", t); // cannot convert 'uint64_t {aka long long unsigned int}' to '__gnuc_va_list {aka __va_list_tag}'

Any suggestion?

Ghanima
4595 silver badges18 bronze badges
asked May 28, 2019 at 20:20
1
  • 1
    char[18] buf; <-- what on earth is this? When you intend to post code in your question, please don't fake the code. Post the real code you actually tried to use. Commented May 29, 2019 at 0:16

1 Answer 1

4

Okay, I figured out... this two prints the right number:

sprintf(dt,"%llu", t);
snprintf(dt, 18, "%llu", t);
answered May 28, 2019 at 20:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.