What is std::strtoul for unicode

Devolus

I'm trying to convert this code to unicode

int fromHex(const supportlib::string_t &s)
{
    return std::strtoul(s.c_str(), NULL, 16);
}

supportlib::string_t is typedefed to std::string or std::wstring depending on whether I want to compile with unicode or ASCII.

With most other types I could find a wide version but not for std::strtoul so what should I use instead? std::wstrtoul doesn't do the trick as with most other types.

I'm using MingW with gcc 4.8.1.

When I compile it in unicode mode, I get this error:

error: cannot convert 'const wchar_t*' to 'const char*' for argument '1' to 'long unsigned int strtoul(const char*, char**, int)'
ooga

In C99 at least, it's in wchar.h and prototyped like this:

unsigned long int wcstoul ( const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related