atoi error!

cout<<"\n "<<subexpresionesparentesis[3]<<subexpresionesparentesis[1]<<subexpresionesparentesis[2];

exponenterestado=atoi(subexpresionesparentesis[3]);

cout<<exponenterestado<<"dx"<<subexpresionesparentesis[1];



I get:
C:\Users\Daniel\Documents\Universidad\ProyectosCpp\derivadas\main.cpp|85|error: cannot convert 'std::string' to 'const char*' for argument '1' to 'int atoi(const char*)'|
seeing line 85 would be helpful
i would be careful about posting all of the error line because now I know your name is Daniel and you are (more than likely) spanish and you either are in or work at a university
line 85 is the exponenterestado=atoi(subexpresionesparentesis[3]);

and there are so many Daniels that are spanish and go to university that I am not worried at all xD!

closed account (o1vk4iN6)
You need to use the c_str() on your string inorder to get a pointer to the actual c-string data.
where do i use that c_Str, and also do I need a special library? I tried to use it and said that c_Str() was not declared...
Probably:
exponenterestado=atoi(subexpresionesparentesis[3].c_str());
Galik I love you ^^ thanks.
no, I know that its common, and that in reality revealed only where the file is stored, but just be careful about how much you put out there
Topic archived. No new replies allowed.