Hi!
I have a string passed to a methos via a string&. I would like to convert this to an unsigned long.
How do I convert the string iterator to a char*?
with all the error checking code removed, it's basically this:
When I try to execute this code I get this error message.
error: cannot convert '__gnu_cxx::__n ormal_iterator< char*, std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >' to 'const char*' for argument '1' to 'long unsigned int strtoul(const char*, char**, int)'|
I have a string passed to a methos via a string&. I would like to convert this to an unsigned long.
How do I convert the string iterator to a char*?
with all the error checking code removed, it's basically this:
Code:
MyFunction(string &s) { string::iterator it = s.begin(); // Sometimes the string is iterated a few characters here DWORD value = strtoul(it, NULL, 16); // Post processing data }
error: cannot convert '__gnu_cxx::__n ormal_iterator< char*, std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >' to 'const char*' for argument '1' to 'long unsigned int strtoul(const char*, char**, int)'|
Comment