• 5189阅读
  • 4回复

[提问]求救!Qstring 转化为int出错!! [复制链接]

上一主题 下一主题
离线leolio
 
只看楼主 倒序阅读 楼主  发表于: 2011-05-14
以下为代码:
               QString temp3;
[pre][/pre][pre]        bool ok1,ok2;[/pre][pre][/pre][pre]        QByteArray temp = myCom ->readAll();[/pre][pre][/pre][pre]        ui->textBrowser->insertPlainText(temp);[/pre][pre][/pre][pre]        temp3 =QString(temp.mid(1,15));[/pre][pre][/pre][pre]       //  qDebug()<<temp3;[/pre][pre][/pre][pre]        int temptest2 = temp3.toInt(&ok1,10);[/pre][pre][/pre][pre]        qDebug()<<temptest2;[/pre][pre][/pre][pre]        int  temptar3 = ui->tarValLineEdit->text().toInt(&ok2,10);[/pre][pre][/pre][pre]        temptar3 =  temptar3*1000;[/pre][pre]串口读回的QByteArray数据转换为Qstring再使用.toInt转化为Int后qDebug()<<temptest2始终输出为0!!![/pre][pre]各位大虾求助哇~~~~~[/pre]
离线leolio
只看该作者 1楼 发表于: 2011-05-14
哎??那么多/pre][pre]是什么?
离线jdwx

只看该作者 2楼 发表于: 2011-05-14
调试
发帖时要说明:操作系统、Qt版本、编译器,这样能更快的得到回复。
离线luoyang

只看该作者 3楼 发表于: 2011-05-14
哥能不能排下序啊~·看的眼花
离线wd007

只看该作者 4楼 发表于: 2011-05-15
把代码整理好,再发上来。
欢迎访问我的博客,一起学习提高
http://blog.csdn.net/qter_wd007
快速回复
限100 字节
 
上一个 下一个