re*******@gmail.com wrote:
Hi All,
I'm trying to print 64 bit int in linux and in windows with cout, can
any one give a solution?
Windows:
__int64 a;
cout<<a;
Linux:
unsigned long long b;
cout<<b;
Thanks,
Reuven.
Most Linux compilers support 64 bit ints.
Take a look at 'stdint.h' (usually in /usr/include).
for the implementation details. 'stdint.h' is part
of the ISO C99 standard.
I don't know if the latest MS compilers have 'stdint.h';
my old copy of Visual Studio 98 does not...
Here's one possibility:
#ifndef _MSC_VER
// not Windows (linux/unix)
#include <stdint.h>
#endif
#ifdef _MSC_VER
__int64 a; // Windows
#else
int64_t a; // not Windows
#endif
std::cout << a;
Regards,
Larry
--
Anti-spam address, change each 'X' to '.' to reply directly.