I need to convert a project from VS2003 to VS2008. In the following code:
wchar_t wpom[30];
mbtowc(wpom, "olaboga", 10);
ati_dom::DOMString w = wpom;
I get an error (on the last line): Cannot convert from ‘wchar_t[30]’ to ‘basic_string<_Elem>’).
I tried to modify it to:
wchar_t wpom[30];
mbtowc(wpom, "olaboga", 10);
std::basic_string<wchar_t> basic_wpom(wpom);
ati_dom::DOMString w = basic_wpom;
But all I acomplished is to get another error: Cannot convert from ‘std::basic_string<_Elem,_Traits,_Ax>’ to ‘std::basic_string<_Elem>’
How can I convert wchar_t[] to basic_string<_Elem> and not to basic_string<_Elem,_Traits,_Ax>…?
Sorry for not responding – i found out what the problem was on my own.
As it turns out, DOMString is declared like this:
So simple casting to unsigned short did the trick: