converting char array to irrlicht strings

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
AshmenGlue
Posts: 29
Joined: Wed Oct 12, 2005 9:09 am

converting char array to irrlicht strings

Post 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?
pfo
Posts: 370
Joined: Mon Aug 29, 2005 10:54 pm
Location: http://web.utk.edu/~pfox1

Post by pfo »

you could do :

Code: Select all

char *sent;
core::stringw received = core::stringc(sent).c_str();
AshmenGlue
Posts: 29
Joined: Wed Oct 12, 2005 9:09 am

Post 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.
Last edited by AshmenGlue on Tue Dec 27, 2005 5:44 pm, edited 1 time in total.
Guest

Post 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];
Post Reply