I/O问题?cin>> cout<< Topic is solved

这是wxWidgets论坛的中文版本。在这里,您可以用您的母语汉语讨论上面任一子论坛所涉及的所有关于wxWidgets的话题。欢迎大家参与到对有价值的帖子的中英互译工作中来!
Post Reply
00061205
Knows some wx things
Knows some wx things
Posts: 41
Joined: Mon Jun 16, 2008 3:43 am
Location: Beijing, China

I/O问题?cin>> cout<<

Post by 00061205 »

如题:请问使用wxWidgets如何将计算结果输出到控制台或从键盘读入数据?

使用cout < < "xxx " < <xxx < <endl; 不行啊

请问wxWidgets有没有自己专门的输出函数?
Regards,

00061205
kingkamg
I live to help wx-kind
I live to help wx-kind
Posts: 187
Joined: Tue Apr 08, 2008 1:45 pm

Post by kingkamg »

NO,使用cin和cout难道不行?
00061205
Knows some wx things
Knows some wx things
Posts: 41
Joined: Mon Jun 16, 2008 3:43 am
Location: Beijing, China

Post by 00061205 »

kingkamg wrote:NO,使用cin和cout难道不行?
可以但是只认char*的变量,要是wxString的要用.mb_str()方法.例如:
wxString str;
cout<<str.mb_str()<<endl;
好像就是这样了,也许还有别的方法。
Regards,

00061205
00061205
Knows some wx things
Knows some wx things
Posts: 41
Joined: Mon Jun 16, 2008 3:43 am
Location: Beijing, China

Post by 00061205 »

像这样进行wxString核std::string之间的转换
std::string str1 = wxT("hello");
wxString str2 = str1.c_str();
std::string str3 = str2.c_str();
Regards,

00061205
Post Reply