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?

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. 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);

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.