RE: [Dev-C++] OT: mingw, printf and DWORD64
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ho...> - 2002-12-19 01:11:40
|
> -----Original Message-----
> From: dev...@li...=20
> [mailto:dev...@li...] On Behalf=20
> Of Marc Heiligers
> Sent: Wednesday, December 18, 2002 2:04 PM
> To: 'Zodiaq'; Dev...@li...
> Subject: RE: [Dev-C++] OT: mingw, printf and DWORD64
>
> -----Original Message-----
> From: Zodiaq [mailto:zo...@ac...]=20
> Sent: 17 December 2002 02:32 PM
> To: Dev...@li...
> Subject: [Dev-C++] OT: mingw, printf and DWORD64
>=20
>=20
> Hello all Dev-cpp-users,
>=20
> I'm writing some apps under DevC++ (which, as everybody=20
> know is great
> IDE) and I've encountered small problem - can't force mingw=20
> to properlsy
> print laaaaaaaarge integers (signed or not)... already
> tried:
> printf( "%lu", ( DWORD64 )-1 );
> but this gives me short number as output...
This isn't right. %lu is for unsigned long. printf("%lu", (unsigned
long)-1)); would be ok.
> and compiler gives me warning:
> warning: long unsigned int format, different type arg (arg 2)=20
> well, with
> <iostream> everything works fine, but I'd like to force=20
> printf to work - it
> must be possible somehow... but how?
You can't force printf() to print a different type value with a =
different
type specifier. Printf() is a variadic function (you know those with the =
...
arguments) and uses internally the pointer type you specify ("%lu" in =
your
case). Either you will use a supported system extension specifier for =
your
type that your printf() implementation supports or you will cast to =
unsigned
long.
Ioannis Vranos
=20
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL: http://run.to/noicys
|