convert CEGUI::String to a char array[] or char*

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

User avatar
Aussie1497
Just popping in
Just popping in
Posts: 1
Joined: Wed Apr 27, 2005 03:39

convert CEGUI::String to a char array[] or char*

Postby Aussie1497 » Wed Apr 27, 2005 03:44

Hi,

I need to grab input from my edit box and set a variable based on that. I have the following in my code:

CEGUI::String ipaddress = ek->window->getText();

I'd like to set ipaddress to either a char* or a char array. How do I accomplish this?

IE: char * ipaddress = ek->window->getText() gives me an error because it's not of type CEGUI::String.

Thanks!

User avatar
daesdemon
Quite a regular
Quite a regular
Posts: 60
Joined: Fri Mar 11, 2005 21:19
Contact:

Re: convert CEGUI::String to a char array[] or char*

Postby daesdemon » Wed Apr 27, 2005 10:22

To have the const char * of a String, i think you can use:

const char* String::c_str();

So ek->window->getText().c_str() can be useful to get it ;)

User avatar
Pacome
Just popping in
Just popping in
Posts: 14
Joined: Fri Dec 02, 2005 11:54
Contact:

Postby Pacome » Fri Feb 24, 2006 13:40

This method only works for CEGUI::String without accents.
It doesn't work with words containing accents, like "hôtel" in french.

You can see the details here with a small source code to test it : http://www.cegui.org.uk/phpBB2/viewtopic.php?t=1206

Regards,

Pacôme


Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 16 guests