再次问一个弱弱的问题:
在wxWidgets中,如何把unsigned char *str类型的字符串复制给wxString。
例如:
unsigned char *str="123";
wxString s;
如何使s的内容成为"123"?
直接 s=str;编译出错。
谢谢!
一个弱弱的问题--wxString Topic is solved
s = wxString(str); 应该可以了。
也可以这样:
wxString s = _T("123");
也可以这样:
wxString s = _T("123");
In fascination of creating worlds by words, and in pursuit of words behind the world.
On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/
On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/
不是(wxString)str,是wxString(str)。两个是完全不同的。你用的那个是类型转换,是不存在的。我说的那个是构造函数。
请多翻阅文档:http://docs.wxwidgets.org/stable/wx_wxs ... inwxstring
你的是Unicode build吗?那么可能得这样做:
const char* ascii_str = "Some text";
wxString str(ascii_str, wxConvUTF8);
请多翻阅文档:http://docs.wxwidgets.org/stable/wx_wxs ... inwxstring
你的是Unicode build吗?那么可能得这样做:
const char* ascii_str = "Some text";
wxString str(ascii_str, wxConvUTF8);
In fascination of creating worlds by words, and in pursuit of words behind the world.
On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/
On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/
Re: 一个弱弱的问题--wxString
wxString::FromAscii((char*)str);adream307 wrote:再次问一个弱弱的问题:
在wxWidgets中,如何把unsigned char *str类型的字符串复制给wxString。
例如:
unsigned char *str="123";
wxString s;
如何使s的内容成为"123"?
直接 s=str;编译出错。
谢谢!