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

Qt Code:
  1. void steg::stego()
  2. {
  3. QProcess *P1 =new QProcess ;
  4. /*char steg_comand[]= "-steg";
  5.   char q_comand[]= "-q";
  6.  
  7.   QStringList s2;
  8.  
  9.   s2 << steg_comand << "coded.txt" << q_comand << ui.compressionspinBox->text() << ui.imagelineEdit->text() << ui.jpeglineEdit ->text() ;
  10.  
  11.   P1->setReadChannelMode(QProcess::MergedChannels);
  12.  
  13.   P1->start( QString("cjpeg.exe"),s2 ); */
  14.  
  15. P1->start(QString("stego.bat")); OR P1->startDetached(QString("stego.bat"));
  16. P1->waitForFinished();
  17. QString result_hide= P1->readAllStandardOutput();
  18.  
  19. QFile file1;
  20. //QDir::setCurrent("E:");
  21. file1.setFileName("hide_error.html");
  22. file1.open(QIODevice::WriteOnly);
  23.  
  24. QTextStream out(&file1);
  25. out << result_hide;
  26. file1.close();
  27. //ui.textBrowser->clear();
  28. QUrl myurl2;
  29. myurl2=QUrl::fromLocalFile( "hide_error.html" ) ;
  30. ui.textBrowser->setSource(myurl2);
  31. }
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.