No, I didn't ask what value you're sending the function. I asked the parameter type. The type that atoi() expects is a const char *, therefore your parameter must have that type -- const char *. A 5 is not a constant char pointer.
The c_str() function returns a const char*, and that is what atoi( ) is expecting.
I replied in the way I did in my original post because whatever the function is that you're calling, you must know the parameter type for each parameter. Otherwise you're not understanding how to call any function when certain parameter types are specified. Always understand what the function you're calling expects as arguments -- don't guess, as everything is (or should be) documented.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; January 22nd, 2011 at 10:25 AM.
Bookmarks