I need to execute a DOS executable program with click of a button in my form designed in QT 4 ( windows)
This DOS executable is an exe file and takes certain switches and filenames (which I supply through lineedits)
Till now I was resorting to using .bat (executable) file where I used to write the whole command as I would have typed on the command prompt and then I execute that bat file with the help of system command . All this I do under a user defined function which is connected to a private slot activated by the click of a button.
This does work but is not correct and also gives bugs sometimes.
I tried the Qprocess thing but somehow it doesnot work.
I tried to adopt the code ( given by patrick08) which is used for seeing the file from the form as below .It does work for seeing file in it’s associated program.

The code for seeing ( say image ) file
Qt Code:
  1. steg::steg(QWidget *parent)
  2. : QDialog(parent)
  3. {
  4. ui.setupUi(this);
  5. connect(ui.showimagefile, SIGNAL(clicked()), this, SLOT(showimagefile()));
  6. }
  7. void steg::showimagefile()
  8.  
  9. {
  10. QProcess p1;
  11. s1 << "url.dll,FileProtocolHandler" << ui.imagelineEdit->text() ;
  12. p1.startDetached(QString("rundll32.exe") , s1 );
  13. }
To copy to clipboard, switch view to plain text mode 
I adopted this for the exe program burp.exe with switches as -e filename1 filename2 -k keystring . The code I tried is as below

Qt Code:
  1. steg::steg(QWidget *parent)
  2. : QDialog(parent)
  3. {
  4. ui.setupUi(this);
  5. connect(ui.encryptpushButton, SIGNAL(clicked()), this, SLOT(encrypt()));
  6. }
  7.  
  8.  
  9. void steg::encrypt()
  10. {
  11. char encrypt_comand[]= " -e ";
  12. char key_comand[]= "-k=";
  13. char space[]= " ";
  14.  
  15. s3 << space<< encrypt_comand<<ui.datalineEdit->text() <<space<< "coded.txt"<<space<<key_comand <<ui.passphraselineEdit->text();
  16. p3.startDetached(QString("burp.exe") , s3 );
  17. }
To copy to clipboard, switch view to plain text mode 
But it doesnot work.
Your comments and guidance please.