Type conversion

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
hansmbakker
Posts: 41
Joined: Mon Feb 16, 2004 7:37 pm

Type conversion

Post by hansmbakker »

hello everybody

i'm trying to make a simple raknet program with irrlicht.
for now it is only a simple gui with textboxes to enter the server ip and port and a connect button.

raknet uses the following command for connecting:
client->Connect(char* host, unsigned short serverPort, unsigned short clientPort, unsigned long connectionValidationInteger, bool highPriorityThreads);

is there a way to convert a wchar_t type of the textboxes (the result of textbox->getText) to char (for the ip) and int or so (for the port)?

thank you!
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

core::stringw textboxText = textbox->getText ( );
core::stringc cText = textboxText;
client->Connect ( cText.c_str(), unsigned short serverPort, unsigned short clientPort, unsigned long connectionValidationInteger, bool highPriorityThreads);
hansmbakker
Posts: 41
Joined: Mon Feb 16, 2004 7:37 pm

Post by hansmbakker »

thank you!

but for conversion to int?
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Code: Select all

core::stringw textboxText = textbox->getText ( ); 
core::stringc cText = textboxText;
int ip = atoi ( cText.c_str ( ) );
hansmbakker
Posts: 41
Joined: Mon Feb 16, 2004 7:37 pm

Post by hansmbakker »

thank you!
Post Reply