Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved] How to compare data read from process->readAllStandardOutput() with a string
I am reading the data from process->readAllStandardOutput() to a QByteArray.in my application I want to compare data read from process with one string, depends upon the string only I will do further step.
I did as below but it's not working
@QByteArray b1=process->readAllStandardOutput() ;
char* text="Unable to read data";
but it does not enter into if condition.
how can I compare the data
You should rather use QString. It has all the function needed for what you want
even for QString also it's not enter to if condition I am already tested
Did you simply check/print the content of b1 ? You might have more data than you think.
it is also completed.
compared data n read data both are same
even it is not come into if condition
if the condition fails it means they are not the same. Maybe a control char like \n that you did not see.
what ever I written in the C-Code the same thing is written in GUI even also if() condition is not satisfied.
Can I add anything more to that string.....
Can you post the exact content of b1 ?
And the code using QString for the comparison ?
dbzhang800 last edited by
please given the result of
sorry for the late reply and thanks for your valuable suggetions I found the solution for this
Could you share the solution ?
Since you got it working, please update the thread title prepending [solved] so other forum users may know that it is working now :)
I am comparing the hexadecimal data directly so it is working.
it is working.