WORKAROUND for >> to work with __int64??
It seems that the << and >> operators (which I am using with cin and cout) weren't defined to allow __int64 operands, so you can cout << __int64 anything, and you can't cin >> __int64 anything.
I found a Workaround on the net that allows you to use << so I can cout << __int64, but I can't find one for >>, and I have no clue how to make one.
The workaround for << is:
Code:
#define WORKAROUND
#include<iostream>
using namespace std;
#ifdef WORKAROUND
std::ostream& operator<<(std::ostream& os, __int64 i )
{
char buf[20];
sprintf(buf,"%I64d", i );
os << buf;
return os;
}
#endif
Anyone know how to make a similar one for >> so I could do something like:
__int64 choice;
cout << "What's your choice?" << endl;
cin >> choice;