From: Micha Feigin on 10 May 2007 13:16 How do I convert a wxString to char *? I keep getting the error can't convert wxChar * to char *. I tried c_str, fn_str and anything else I could find. --------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
From: Vaclav Slavik on 10 May 2007 13:22 Micha Feigin wrote: > I keep getting the error can't convert wxChar * to char *. > I tried c_str, fn_str and anything else I could find. mb_str(). Regards, VS -- PGP key: 0x465264C9, available from http://pgp.mit.edu/
From: "Greg Hellings" on 10 May 2007 13:28 It might be nice to include an overload of the casting operator in the class, so this problem can be handled automatically? On 5/10/07, Vaclav Slavik <vslavik(a)fastmail.fm> wrote: > Micha Feigin wrote: > > I keep getting the error can't convert wxChar * to char *. > > I tried c_str, fn_str and anything else I could find. > > mb_str(). > > Regards, > VS > > -- > PGP key: 0x465264C9, available from http://pgp.mit.edu/ > > --------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
From: Preben Friis on 10 May 2007 19:00 "Micha Feigin" <michf(a)post.tau.ac.il> wrote in message news:20070510201642.19f6c8b7(a)litshi.luna.local... > How do I convert a wxString to char *? > > I keep getting the error can't convert wxChar * to char *. > I tried c_str, fn_str and anything else I could find. Do you really need to convert it to a non-const char*? The normal operator overloading works for const char* /Preben Friis
From: Micha Feigin on 10 May 2007 20:37 On Fri, 11 May 2007 01:00:13 +0200 "Preben Friis" <noone(a)technologist.com> wrote: > > "Micha Feigin" <michf(a)post.tau.ac.il> wrote in message > news:20070510201642.19f6c8b7(a)litshi.luna.local... > > How do I convert a wxString to char *? > > > > I keep getting the error can't convert wxChar * to char *. > > I tried c_str, fn_str and anything else I could find. > > Do you really need to convert it to a non-const char*? The normal operator > overloading works for const char* > It has the same problem of c_str of converting to wxChar which is a char in non-unicode build but wchar in unicode build. Took me some to time to find out that under visual studio 2005 it inherited unicode and _unicode for some reason which made it thing it was a unicode build even when it wasn't. To your second question, I do need a char * and not a const char * since I need to build a vector (stl) of char * to pass to an external function. I ended up doing a non-unicode build and using strncpy. I don't think it's a good solution but it's a piece of code used for QA so it's not worth the trouble looking for a better one at the moment (although I'd be happy to know what is the correct way to do this next time I have to do it in production code). > /Preben Friis > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org > For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org > --------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
|
Next
|
Last
Pages: 1 2 Prev: ANN: wxMySQL Class: Direct Connection to MySQL Server Next: consoleApp |