Re: converting string into integer
- From: spibou@xxxxxxxxx
- Date: 17 Jul 2006 15:37:04 -0700
priyanka wrote:
Hi there,
I want to convert a String into integer.
I get the string froma file using :
string argNum;
getline(inputStream,argNum);
What is this getline function you're speaking of ?
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*)'
Since this std::string thingy is not C you were bound to get an error.
By the way , C++ questions should be asked at comp.lang.c++
And for the getline function, the argNum must be a string variable.
Can anyone please tell me how to convert argNum into integer ?
If argNum is pointer to char , then you use atoi. In C that is.
Spiros Bousbouras
.
- References:
- converting string into integer
- From: priyanka
- converting string into integer
- Prev by Date: Re: convert int to string without using standard library (stdio.h)
- Next by Date: Re: convert int to string without using standard library (stdio.h)
- Previous by thread: Re: converting string into integer
- Next by thread: Re: converting string into integer
- Index(es):
Relevant Pages
|