Probably that is the problem.I am sure it is not behaving as a normal .exe
I tried to run it through a bat (stego.bat)file in which i wrote the command cjpeg
The code was as
void steg::stego()
{
/*char steg_comand[]= "-steg";
char q_comand[]= "-q";
QStringList s2;
s2 << steg_comand << "coded.txt" << q_comand << ui.compressionspinBox->text() << ui.imagelineEdit->text() << ui.jpeglineEdit ->text() ;
P1->setReadChannelMode(QProcess::MergedChannels);
P1->start( QString("cjpeg.exe"),s2 ); */
P1
->start
(QString("stego.bat")); OR P1
->startDetached
(QString("stego.bat"));
P1->waitForFinished();
QString result_hide
= P1
->readAllStandardOutput
();
//QDir::setCurrent("E:");
file1.setFileName("hide_error.html");
out << result_hide;
file1.close();
//ui.textBrowser->clear();
myurl2
=QUrl::fromLocalFile( "hide_error.html" ) ;
ui.textBrowser->setSource(myurl2);
}
void steg::stego()
{
QProcess *P1 =new QProcess ;
/*char steg_comand[]= "-steg";
char q_comand[]= "-q";
QStringList s2;
s2 << steg_comand << "coded.txt" << q_comand << ui.compressionspinBox->text() << ui.imagelineEdit->text() << ui.jpeglineEdit ->text() ;
P1->setReadChannelMode(QProcess::MergedChannels);
P1->start( QString("cjpeg.exe"),s2 ); */
P1->start(QString("stego.bat")); OR P1->startDetached(QString("stego.bat"));
P1->waitForFinished();
QString result_hide= P1->readAllStandardOutput();
QFile file1;
//QDir::setCurrent("E:");
file1.setFileName("hide_error.html");
file1.open(QIODevice::WriteOnly);
QTextStream out(&file1);
out << result_hide;
file1.close();
//ui.textBrowser->clear();
QUrl myurl2;
myurl2=QUrl::fromLocalFile( "hide_error.html" ) ;
ui.textBrowser->setSource(myurl2);
}
To copy to clipboard, switch view to plain text mode
When I used P1->start(QString("stego.bat)); the dos screen appeared and I found the error message(as it should have come) and then the screen disappeared since I have not put any code to stop that. It means there was output to console as I want it . But it didnot get captured to QString result_all . How can I capture it (but keeping only start()) and then redirect to textbrowser.
when I used P1->startDetached (QString("stego.bat)); as expected no screen appeared and the cjpeg command did not run. And interestingly i get the out put as
C:\Qt\4.1.3\stegform1\release>cjpeg
where "C:\Qt\4.1.3\stegform1\release" is the current directory and cjpeg is thecommand written in stego.bat. If i could simulate "enter" after cjpeg in stego.bat perhaps it would have executed.
Can u suggest a way out. I cannot change cjpeg.exe.
Bookmarks