Re: converting string into integer



On 17 Jul 2006 17:48:03 -0700, "Andy" <andy660@xxxxxxxxx> wrote in
comp.lang.c:

Please don't trim attribution lines. I've put it back:

On 17 Jul 2006 15:22:23 -0700, "priyanka" <priyankabhar@xxxxxxxxx> wrote in comp.lang.c:

....that's better!


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*)'

You can use argNum.c_str() to solve this problem.

No he can't, not in C.

I think you are a newer to C++. This is a very basic problem. You can
find the answer in many books very easily.

He has a much more basic problem. He either can't distinguish between
C and C++, or he can't distinguish between comp.lang.c and
comp.lang.c++. Until he gets that issue straightened out, I foresee a
world of hurt in his future.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
.