is there a bug ?:
char *p = new char[100];
wxString msg = p;
------------>is there a ambigous error?
if the code like this:
char *p = new char[100];
wxString msg = wxT( p );
------------>gcc error: the Lp is not declared
about wxString and char[100]
-
- Knows some wx things
- Posts: 38
- Joined: Tue Nov 07, 2006 1:19 pm
-
- Knows some wx things
- Posts: 26
- Joined: Tue Nov 14, 2006 1:51 pm
- Location: Duesseldorf, Germany
Probably your wxWidgets is compiled in Unicode mode. Then, wxString doesn't manage character arrays, but wide character arrays. You cannot pass narrow character arrays directly. Furthermore, the wxT macro is useful only for string literals. Two ways to make this work:
Code: Select all
// using wide characters directly
wchar_t* p = new wchar_t[100]; // or use wxChar instead, to stay compatible to ANSI-Mode
wxString msg = p;
// converting narrow to wide characters
char* p = new char[100];
wxString msg( p, wxConvLibc ); // or any other wxConvXYZ, depending on the encoding of p