i'm trying to convert a string into an integer by using atoi() function. but it gives me an error:
error C2664: 'atoi' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'const char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

i've looked up how to use atoi() and i'm positive i'm using it right can someone offer some insight?

string b;
//b is given a value inbetween these two commands by way of
//a loop.

thanks for any help

atoi needs a pointer to a C-style string.


thanks that worked great.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.