求助各位大神!!代码如下:
mytest.h
#ifndef MYTEST_H_
#define MYTEST_H_
#include <QtGui/QWidget>
#include <QtGui/QPushButton>
class MyTest : public QWidget
{
Q_OBJECT
public:
MyTest();
~MyTest();
public slots:
void invokeC();
private:
QPushButton *pb;
};
#endif
MyTest.cpp
MyTest::MyTest()
:QWidget()
{
this->setGeometry(0,0,200,50);
pb=new QPushButton("点击调用C程序",this);
pb->setGeometry(0,0,200,50);
connect(pb,SIGNAL(clicked()),this,SLOT(invokeC()));
}
MyTest::~MyTest()
{
}
void MyTest::invokeC()
{
QProcess *process=new QProcess();
QStringList str;
str.clear();
str << "a" << "b" ;
process->start("../C/test",str);
process->waitForStarted();
process->waitForFinished();
QByteArray qb=process->readAll();
QString str22(qb);
QTextStream cout(stdout);
cout<<str22<<endl;
}
Main.cpp
int main(int argc,char *argv[])
{
QApplication a(argc,argv);
QTextCodec *codec = QTextCodec::codecForLocale();
QTextCodec::setCodecForCStrings(codec);
a.setFont(QApplication::font());
MyTest *mt=new MyTest;
mt->show();
return a.exec();
}
求各位大神看看哪里出错了??拜托拜托!!!
------解决方案--------------------
编译出错的 也得贴出来吧 骚年。。。
------解决方案--------------------
是啥错误?贴出来