More SPRINTF woes! [solved]

This isn't funny anymore. First I find out that SPRINTF doesn't support floating point without a hack... solved that problem. NOW it seems like there's a limit to printing HEX values as well.

Here's my test sketch:

void run_test(void) {
    char buffer[32];
    const char *mask = "Value is 0x%08X\r\n";
    uint32_t value = 0x12345678;
    sprintf(buffer, mask, value);
    Serial.write(buffer);
}

void setup(void) {
    Serial.begin(115200);
    run_test();
}

void loop(void) {
}

Of course, I expected to see:

Value is 0x12345678

But, instead I get this:

Value is 0x00005678

What the heck is going on here?

Any ideas will be appreciated.

(p.s. I don't want any "alternate" methods of making the output correct - I can do that any number of ways. I want to FIX SPRINTF if possible).

Thanks.

-- Roger

You need to tell sprintf if a variable is long.

    const char *mask = "Value is 0x%08lX\r\n";

MarkT:
You need to tell sprintf if a variable is long.

    const char *mask = "Value is 0x%08lX\r\n";

OMG I feel so stupid. I knew that.

Thank you!

-- Roger