Is possible to read data of QProcess::readAllStandardOutput() which the process having time delay



  • hai,,

    I am able to read data of a process which was normal C- code and it have while(1) condition but it does not have any delay functions.

    If I add any delay like for() loop or sleep() or timer value then Qprocess::readAllStandardOutput() was unable read any data from console how can I read data from process? Is it possible or not?

    In this delay program I removed the QProcess::waitforfinished() also, even it is not able to read data.

    If any body have the Idea then please help me



  • Use signals QProcess::readyReadStandardOutput to connect it to your reading slot. With event based programming you can avoid while loops.



  • thank you for your replay I am able to read the data of infinite loop using this signal and slot mechanism only.

    according to my application I want an infinite loop with some time delay thats why I am asking this question

    is there any other chances to over come this problem



  • I fail to understand why do you need a infinite loop if you are using a event based mechanism. May be if you can post some code or rephrase the problem then it is easier to understand.
    Moreover, if you halt the reading thread in an infinite loop, there is no way you can read it, for it was you who told it to sleep!!
    I think I am not understanding your problem.



  • My project was related to Industrial project. In this QT is used as user friendly (like used as HMI) to client. Background of qt we are running a process which is C-based code, C-Code is communication between qt to hardware.

    C-Code was reading the data from hardware using some API related to that hardware. The reading data from hardware is displayed on terminal and it was read by qt using Qprocess::readAllStandardOutput().

    It is real time based project so we want while() loop in that c code,
    according to the hardware we want time delay which is less than 100msec.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.