Urgent Question!!!!!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Thomaskkc
Posts: 134
Joined: Fri Sep 15, 2006 4:04 pm

Urgent Question!!!!!

Post by Thomaskkc »

Do anyone kown how to convert from 'wchar_t' to 'const irr::c8 *'
??

i have a problem like this
\virtualmuseum\modeleventreceiver.cpp(189): error C2440: '=' : cannot convert from 'wchar_t' to 'const irr::c8 *'

THANKS~~
PLS HELP~~!
CuteAlien
Admin
Posts: 9716
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

If you have no problem using the standard libraries (#include <string>) you can do it that way:

Code: Select all

wchar_t * someStringW = L"hello world";
std::wstring wstr( someStringW );
std::string dummy( wstr.begin(), wstr.end() );
const irr::c8 * result = dummy.c_str();
You will certainly lose anything which is actually using wchar_t's (for example you will no longer be able to translate it into japanese).

Another thing regarding this post:
Don't *ever* use threadtitles like "Urgent Question!!!!". It makes you look bad. Use a title which tells about the problem (like: How to convert from wchar_t to irr::c8*). And avoid the !!!! and ?? - same reason.

And most importantly: learn using the search button in this forum - i can just bet this question has been asked a lot of times.
Post Reply