|
-
February 7th, 2005, 03:39 AM
#1
type specifier for 64-bit integers ?
Dear friends,
I wanted to write a 64-bit integer to a string and used the wsprintf function as below. Although the value is correctly assigned to the variable, it seems like truncated in the printed string.
Code:
ULONGLONG DiskSize;
:
:
wsprintf(msg," Disk size = %lu bytes", DiskSize);
Is there any special type specifier that can be used with wsprintf() instead of %lu? (%I64d doesn't work with wsprintf() )
Help me ...!
susiriss.
-
February 7th, 2005, 04:21 AM
#2
Re: type specifier for 64-bit integers ?
I thought this function named swprintf? And this function worked fine for me. BTW it is:
Code:
wsprintf(msg, L" Disk size = %lu bytes", DiskSize);
Otherwise this string literal is not unicode.
-
February 7th, 2005, 02:59 PM
#3
Re: type specifier for 64-bit integers ?
the Windows API function wsprintf() does not support 64 bit integers, nor does it support floating point variables of any kind.
The easiest solution would be to use the sprintf() function available in the C Runtime libary.
If your are aiming for a small footprint, that will require the CRT, and will add quite a bit of code (mainly because of the FPU support the CRT sprintf() has.
Alternatively, you could use %s for int64, and create a function that converts an int64 to a string yourself before passing it to wsprintf().
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|