QProcess readStdOut index
How do I read external file that returns me the output with each index values.
The index values are : 0 to 3;
I want to read the output from "testFile" with index. The bash file "testFile" executes with index values like this:
Code:
./testFile 1
output:-" This is my test1"
./testFile 2
output:-" This is my test2"
./testFile 3
output:-" This is my test3"
Code:
void CMainView::ReadFileValue()
{
//Add the argument of the process
process->addArgument( "/bash" );
process->addArgument ("testFile");
connect(process, SIGNAL(readyReadStdout()), this, SLOT(readTestFileOut()));
if (!process->start())
{
qDebug("Error with process");
}
}
void CMainView::readTestFileOut()
{
QString str
= process
->readStdOut
();
//str prints only first line i.e." This is my test1"
//I want to achieve like below:-
lineEdit1->setText(str1); //str1 would be This is my test1
lineEdit2->setText(str2); //str2 would be This is my test2
lineEdit3->setText(str3); //str3 would be This is my test3
}
Re: QProcess readStdOut index
Can't re-use the index that you pass as an argument to that process?