P
priyanka
Hi there,
I want to convert a String into integer.
I get the string from a file using :
string argNum;
getline(inputStream,argNum);
I now need to convert argNum into integer.
I tried to use
int a = atoi(argNum);
But I got errot message :error: cannot convert `std::string' to `const
char*' for argument `1' to `int atoi(const char*)'
And for the getline function, the argNum must be a string variable.
Can anyone please tell me how to convert argNum into integer ?
Thank you in advance,
priya
I want to convert a String into integer.
I get the string from a file using :
string argNum;
getline(inputStream,argNum);
I now need to convert argNum into integer.
I tried to use
int a = atoi(argNum);
But I got errot message :error: cannot convert `std::string' to `const
char*' for argument `1' to `int atoi(const char*)'
And for the getline function, the argNum must be a string variable.
Can anyone please tell me how to convert argNum into integer ?
Thank you in advance,
priya