I have a variable:
string item;
It is initialized at runtime. I need to convert it to long. How to do it? I tried atol () and strtol (), but I always get the following error for strtol () and atol () respectively:
cannot convert 'std::string' to 'const char*' for argument '1' to 'long int strtol(const char*, char**, int)' cannot convert 'std::string' to 'const char*' for argument '1' to 'long int atol(const char*)'
source share