Converting a C string to wxString
Marc de Kamps
dekamps at comp.leeds.ac.uk
Fri Jan 4 04:29:06 PST 2008
Hi,
I'm a novel user of wxGTK. I have to port some legacy code to the latest
version that we use here 2.8 on a FEDORA linux platform compiled with
Unicode support. The old code used version 2.4.2.
One of the main differences appear to be that there is no more implicit
conversion from (ANSI) C strings to wxString
I have read the documentation under Unicode:
- I understand that literals can be converted using the _T() macro and that
this will be expanded into the correct format whether one uses Unicode
support or not.
- I understand that when I need an ANSI C string, for example because it
needs to be converted to an STL string, I can use mb_str().
What I do not understand is how an ANSI C string that is not a literal
should be converted into a wxString, for example,
I've been passed an STL string str_example and apparently I need a converter
object to convert into a wxString object:
wxString wx_example(str_example.c_str(),*wxConvCurrent);
How do I do determine which converter I need?
Thanks,
Marc
More information about the wx-users
mailing list