CEGUI::String

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
shmrod
Just popping in
Just popping in
Posts: 3
Joined: Wed Aug 10, 2005 04:56

CEGUI::String

Postby shmrod » Sat Nov 12, 2005 12:56

Hi,

How do you transform a CEGUI::String to std::string.
I 'm trying to catch an Cegui::exception, and write it in my log...

thanks

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: CEGUI::String

Postby lindquist » Sat Nov 12, 2005 15:36

Use the "CEGUI::String::c_str" member to get a C string version of the "CEGUI::String" content.

Code: Select all

CEGUI::String cs("test");
std::string s(cs.c_str());
cout << s << endl;


HTH

edit:

Code: Select all

catch (CEGUI::Exception& e)
{
    std::string s(e.getMessage.c_str());
    std::cout << s << std::endl;
}

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:34

This method only works for CeGUI generated exceptions, but it doesn't work for general CEGUI::String to std::string conversion.

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 “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 5 guests