Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] How to compare data read from process->readAllStandardOutput() with a string
Forum Updated to NodeBB v4.3 + New Features

[Solved] How to compare data read from process->readAllStandardOutput() with a string

Scheduled Pinned Locked Moved General and Desktop
12 Posts 3 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    You should rather use QString. It has all the function needed for what you want

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Swinetha
      wrote on last edited by
      #3

      even for QString also it's not enter to if condition I am already tested

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        Did you simply check/print the content of b1 ? You might have more data than you think.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Swinetha
          wrote on last edited by
          #5

          it is also completed.

          compared data n read data both are same
          even it is not come into if condition

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            if the condition fails it means they are not the same. Maybe a control char like \n that you did not see.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Swinetha
              wrote on last edited by
              #7

              hi
              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.....

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                Can you post the exact content of b1 ?
                And the code using QString for the comparison ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dbzhang800
                  wrote on last edited by
                  #9

                  please given the result of

                  qDebug()<<b1.toHex();

                  and

                  qDebug()<<QByteArray(text).toHex();

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    Swinetha
                    wrote on last edited by
                    #10

                    sorry for the late reply and thanks for your valuable suggetions I found the solution for this

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      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 :)

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        Swinetha
                        wrote on last edited by
                        #12

                        I am comparing the hexadecimal data directly so it is working.

                        like if(b1.toHex()==QByteArray(text).toHex())

                        it is working.

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved