标题:串口问题
作者:map_j
日期:2006-08-18 16:02
内容:
如果串口有数据的话
读没问题
但如果没有数据stream.readLine()是就会出错
#1 [map_j 08-19 10:58]
自己顶一下
QFile file("/dev/ttyS0");
file.open(IO_ReadOnly);
QTextStream stream( &file );
QString line;
while ( !stream.eof() ) {
line = stream.readLine(); // 不包括“\n”的一行文本
//读不到数据就一直在等,程序停下来了,建了个线程也不行
cout
#2 [ball 08-22 11:29]
應該是 while ( !stream.atEnd() ) 才對
理論上
檔案一定會讀至結尾
不會出現妳讀不了數據的問題
#3 [hongri 08-22 11:35]
stream.atEnd()