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
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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
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).
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.