Originally posted by Stoned_Coder
i think its a little more involved than that. this wont work for instance.
Code:
std::ostream& operator << (std::ostream& os,__int64& bigint)
{
__int32 top = (bigint >> 32) & 0xffffffff;
__int32 bottom = bigint & 0xffffffff;
(top==0)? os<<bottom:os<<top<<bottom;
return os;
}
edit....
actually something along these lines with a corresponding operator >> for reading in from a file should work but it would not work for printing to cout. if you only want file use and no need to print to cout then this could be good enough
Yeah...maybe my answer was a bit too brief and narrow....I didnt think it through too well....actually it works ok if you normally count in hex (looks to adrian ).....
You can cheat though
Code:
#include <iostream>
#include <windows.h>
std:: ostream& operator<<(std:: ostream& out,const __int64& i64){
char buff[21];
wsprintf(buff,"%I64d",i64);
out << buff;
return out;
}
int main( void )
{
__int64 i64 = 50000000000000;
std::cout << i64 << std::endl;
return 0;
}