From: adebaene on
On 25 avr, 00:33, Tamas Demjen <tdem...(a)yahoo.com> wrote:
> Igor Tandetnik wrote:
> >> I'm trying to write to a file using fprintf_s a value of type
> >> unsigned long long, using the format specifiers "%ld"
>
> > %ld is plain vanilla long. You want %llu or %I64u
>
> It's very hard to be 100% portable with this:
> VC++: %I64u or %llu
> GNU g++, Solaris: %llu
> Borland: %Lu or I64u
>
Yet another reason to use std::fstream and operator <<....

Arnaud
From: Ulrich Eckhardt on
adebaene(a)club-internet.fr wrote:
> On 25 avr, 00:33, Tamas Demjen <tdem...(a)yahoo.com> wrote:
>> It's very hard to be 100% portable with this:
>> VC++: %I64u or %llu
>> GNU g++, Solaris: %llu
>> Borland: %Lu or I64u
>>
> Yet another reason to use std::fstream and operator <<....

'long long' is not a type in C++, so you can't write it (or __int64) to an
ostream portably...

Well, but at least IOStreams allow extension and selecting the right
overload.

happy weekend!

Uli

--
C++ FAQ: http://parashift.com/c++-faq-lite

Sator Laser GmbH
Geschäftsführer: Michael Wöhrmann, Amtsgericht Hamburg HR B62 932