I\'m trying to convert 64bit integer string to integer, but I don\'t know which one to use.
You've tagged this question c++, so I'm assuming you might be interested in C++ solutions too. You can do this using boost::lexical_cast
or std::istringstream
if boost isn't available to you:
#include
#include
#include
#include
#include
int main() {
uint64_t test;
test = boost::lexical_cast("594348534879");
// or
std::istringstream ss("48543954385");
if (!(ss >> test))
std::cout << "failed" << std::endl;
}
Both styles work on Windows and Linux (and others).
In C++11 there's also functions that operate on std::string, including std::stoull
which you can use:
#include
int main() {
const std::string str="594348534879";
unsigned long long v = std::stoull(str);
}