hi,
in c there is a way of getting a unsigned long long into a char array by using sprintf, is there a method in c++ that gets an ull into a string?
thx
Printable View
hi,
in c there is a way of getting a unsigned long long into a char array by using sprintf, is there a method in c++ that gets an ull into a string?
thx
stringstream - but I thought you weren't supposed to use C++?
--
Mats
how do u use it?
unsigned long long input;
stringstream ss;
string s;
s << input;
EDIT:Code:unsigned long long input = 1234ULL;
stringstream ss;
string s;
ss << input;
ss >> s; // or s = ss.str();
Oops, unsigned long long, not unsigned long. Note that (signed/unsigned) long long is non-standard in C++ though available as an extension on some compilers.
and __int64 on some others.
> in c there is a way of getting a unsigned long long into a char array by using sprintf,
Yes there is, but the conversion format still depends on your OS/Compiler (until everyone supports C99 properly).