Converting a C string to wxString
Steven Van Ingelgem
steven at vaningelgem.be
Fri Jan 4 04:35:40 PST 2008
Generally you only need the current convertor unless you know yourself
you need utf8/7/16/other convertor. It's up to you to know what you
pass as the convertor. If you're complete program is using UTF8 (you
mentioned gtk right) then i'd say, just use the UTF8 convertor
(wxConvUTF8).
Hope this helps
On 04/01/2008, Marc de Kamps <dekamps at comp.leeds.ac.uk> wrote:
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
>
More information about the wx-users
mailing list