I build an app that execute linux command through C++ Qt GUI I read from the file and show the output normally but sometimes the output from file is data = "" and the output that - in normal show in terminal - show in Application output so I want to get a application output to Qwidget such as QTextEdit
like
cat:: /home/user/Desktop: Is ad directory ,
the function I used it is
QString operation :: commands(std::string usercommand){
const char * convertor = userCommand.c_str();
string data;
FILE *f =popen(convertor,"r");
char buffer [1024];
while (fgets(buffer,sizeof(buffer)-1,f)!=NULL){data=data+buffer;}
pclose(f);
QString returning = QString::fromStdString(data); return returning; }
QProcessinstead of this.