wchar_t conversion (aka: arghhh ... bloody wchar_t´s)

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
StickyBit
Posts: 94
Joined: Mon Jul 05, 2004 3:40 am
Location: Sønderup, Denmark
Contact:

wchar_t conversion (aka: arghhh ... bloody wchar_t´s)

Post by StickyBit »

Hi guys

Damn .. I'm banging my head against the wall right now - cuz´ I just cant figure out how to convert the Gui´s editboxes wchar_t values - into something usefull. Damn you wchar_t´s :evil:

Could someone please post a code snippet for converting the editbox content to a char* and an int. The code need to work with mingw (win32) and gcc (Linux).

Regards Stickybit
Perceval
Posts: 158
Joined: Tue May 30, 2006 2:42 pm

Post by Perceval »

This question has been asked a million time, and a quick search give you an answer, this one for example :
http://irrlicht.sourceforge.net/phpBB2/ ... conversion
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

I do it the easy way, like this

Code: Select all


wchar_t* SomePointer;
stringc Temp(SomePointer);
char *AnotherPointer=Temp.c_str();

//Or the other way around

char* SomePointer;
stringw Temp(SomePointer);
wchar_t *AnotherPointer=Temp.c_str();

I'm surprised that a lot of people have missed the simple and handy function atoi. Guess what it does? It takes an ascii-string and returns an integer :)

Code: Select all

char *SomeString;
int MyInt=atoi(SomeString);
If you don't have anything nice to say, don't say anything at all.
Post Reply