I am writing in C++ and I have a string. I want to check if this string is only numbers and If it is I want to change the type to long int.
stringT = "12836564128606764591";
bool temp = false;
for(char& ch : stringT)
{
if(!isdigit(ch))
{
temp=true;
break;
}
}
if(temp != true)
{
itm = new Item_int((long long) strtoll(stringT.c_str(), NULL, 0));
std::cout << " itm:" << *itm << std::endl;
}
but the result of print is: 9223372036854775807