I have tried these ones:

Qt Code:
  1. m_process->setCommunication( Q3Process::Stdin | Q3Process::Stdout | Q3Process::Stderr | Q3Process::DupStderr);
  2. m_process->start()
  3. while(m_process->canReadLineStdout() )
  4. qDebug()<<m_process->readLineStdout();
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. connect( m_process, SIGNAL(readyReadStdout()), this, SLOT(readStandardOutput()) )
  2. m_process->setCommunication( Q3Process::Stdin | Q3Process::Stdout | Q3Process::Stderr | Q3Process::DupStderr);
  3. m_process->start();
  4. ....
  5. qDebug()<<m_process-> readStdout() [in readStandardOutput() slot]
To copy to clipboard, switch view to plain text mode 


Qt Code:
  1. m_process = new QProcess(this);
  2. m_process->setProcessChannelMode(QProcess::MergedChannels);
  3. connect(m_process, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError()));
  4. connect(m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput()));
  5. startProcess(m_progname);
  6. ...
  7. qDebug()<< QString(m_process->readAllStandardError()); [readStandardError() slot]
  8. ...
  9. qDebug()<< QString(m_process->readAllStandardOutput()); [readStandardOutput() slot]
  10. ...
  11.  
  12. [as I said if I close write channel in readStandardError() slot, I will get those lines ]
To copy to clipboard, switch view to plain text mode 

I even tried to redirect outputs to files, but again no success in getting those lines before stdin prompt. Am I doing something wrong?

I have reviewed some codes of others (both qt3 and qt4) especially codes of IDEs but no success. I would be happy even if you point me some where (code, thread..) to learn more.
I tried Google and Koders, but no success again.

Besides, is there any non-qt work-around for this problem? Do you know some pure C++ console like code, which is wrapped in qt?