Page 1 of 1

converting char array to irrlicht strings

Posted: Sun Dec 25, 2005 1:05 pm
by AshmenGlue
For my program I need to send a wchar_t to the server. I am using RakNet, so I've converted my wchar_t to a char array like this:

Code: Select all

char name[256];
strcpy(name,stringc(gamemgr->playername).c_str());
Now the problem comes when the server receives the packet. How do I convert back from char array to w_char_t?

Posted: Sun Dec 25, 2005 11:47 pm
by pfo
you could do :

Code: Select all

char *sent;
core::stringw received = core::stringc(sent).c_str();

Posted: Tue Dec 27, 2005 7:28 am
by AshmenGlue
Thanks your suggestion compiled fine but I am getting the converted string as some nonsense combination of numbers.

Now I think it's the way I'm sending the char array. I'v posted in the RakNet forums for help. Thanks for the help here pfo.


VVVVV That's me sorry. Forgot to log in.

Posted: Tue Dec 27, 2005 5:43 pm
by Guest
I solved the sending problem. Now I have to convert a char array to a wchar_t so I can display it in Irrlicht. How would I go about doing this?

I have a char name[256];