Re: wsprintf I64 - how to get it to include a plus sign ?
Paul <[email protected]> Wed, 7 Jan 2026 17:04:27 -0500
| Newsgroups | comp.os.ms-windows.programmer.win32,alt.comp.os.windows-xp,alt.windows7.general |
|---|---|
| Organization | A noiseless patient Spider |
| Message-ID | <[email protected]> |
On Wed, 1/7/2026 3:14 PM, R.Wieser wrote:
> JJ,
>
> [quote=me]
>> Scratch that question.
>
> Scratch that. I'd forgotten that I had changed my test value, and caused it
> to fit into 4 bytes. Changing it back to 5E+10 the displayed result showed
> again a truncated 32-bit result
>
> Strange that "%lld" was not rejected as unrecognised though ...
>
> So, the question still stands :
>
> Any idea how to have sprintf (crtdll) print a 64-bit decimal value ?
>
> Regards,
> Rudy Wieser
>
>
I couldn't get my INT64_T to work, and I suspect I need to install
more packages in my mingw64 thingy. Adding the header files made no difference.
/* #include <stdint.h> */
/* #include <inttypes.h> */
#include <stdio.h>
/* gcc -std=c99 -o wide.exe wide.c */
/* gcc -m64 -std=c99 -o wide.exe wide.c */
int main( void )
{
wchar_t buf[100];
/* int64_t i; */
long long int i;
i = 5000000000000 ;
int len = swprintf( buf, 100, L"%s %+lld %s", L"Pack my box with ", i, L" liquor jugs" );
printf( "Generated %d characters\n\n", len );
wprintf(L"%ls\n\n", buf);
}
UCRT64 ~
$ ./wide
Generated 45 characters
Pack my box with +5000000000000 liquor jugs
UCRT64 ~
Paul