主函数如下,其它是下载QextSerialPort的类,版本0.9,用的是qt3.3.7
#include <qapplication.h>
#include <qlabel.h>
#include "win_qextserialport.h"
int main(int argc , char **argv)
{
QApplication myApp(argc,argv);
QLabel myLabel("Hello",0);
Win_QextSerialPort *RS232 = new Win_QextSerialPort("/dev/ttyS0");
RS232->setBaudRate(BAUD115200); //com1,115200,n,8,1
RS232->setFlowControl(FLOW_OFF);
RS232->setParity(PAR_NONE);
RS232->setDataBits(DATA_8 );
RS232->setStopBits(STOP_1);
if (RS232->open())
{
RS232->putch('a');
RS232->putch('a');
RS232->flush();
RS232->close();
}
myApp.setMainWidget(&myLabel);
myLabel.show();
return myApp.exec();
}
编译通过了,但是发不出来数据,请问高手是怎么回事情?
[ 此贴被XChinux在2007-01-22 00:08重新编辑 ]