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. convert string to hex
Forum Updated to NodeBB v4.3 + New Features

convert string to hex

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 4 Posters 3.6k Views 2 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.
  • V Offline
    V Offline
    veysel.olgun
    wrote on last edited by veysel.olgun
    #1

    hello, how can i convert QString to hex this is part of my code :

    QString a=ui->lineEdit->text();

    if a=="ffaabbccdd" is working fine but
    if a=="veyselolgun" it is not work correctly

    can anyone help me

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mark81
      wrote on last edited by
      #2

      Your code just assigns to a variable the content of your QLineEdit. It's not clear what do you mean with "convert to hex". Hex it just a presentation format, not the number itself. If you have an hex string (like "ffaabbccdd") you can convert it to a number:

      QString a = "ffaabbccdd";
      qDebug() << a.toLongLong(nullptr, 16);
      // output: 1098081094877
      

      and of course it won't work with "veyselolgun" because it's not a valid hex string.

      1 Reply Last reply
      2
      • V Offline
        V Offline
        veysel.olgun
        wrote on last edited by
        #3

        @Mark81 said in convert string to hex:

        a.toLongLong(nullptr, 16);

        i want to send to card reader when i entry to Qlineedit veyselolgun data, and i want to receive this data veyselolgun from card reader

        for example when i entry to Qlineedit aabbccddeeff data, it sending to card reader and i am receiving response that is aabbccddeeff from card reader

        i hope i express what i want to do
        thank you

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

          Hi,

          What exactly is your card reader expecting ?

          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
          1
          • V Offline
            V Offline
            veysel.olgun
            wrote on last edited by veysel.olgun
            #5

            Example: write to block 40: “00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F” //this is what i send but i want to send for example "hello world" or "data was written"

            Successful operation:

            REQUEST : HOST->READER: 02 1B 00 3E DF 78 12 A6 28 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 1C 03

            ACKOWLEDGE : READER->HOST: 02 08 00 3E 00 00 34 03
            RESPONSE : READER->HOST: 02 0D 00 3E FF 01 04 DF 78 01 A6 CB 03

            1 Reply Last reply
            0
            • V Offline
              V Offline
              veysel.olgun
              wrote on last edited by
              #6

              when i want to read block of 40 i have to show that :

              Example: read block 40 (0x28)

              Successful read of “00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F”:

              REQUEST : HOST->READER: 02 0B 00 3E DF 78 02 A5 28 1F 03

              ACK : READER->HOST: 02 08 00 3E 00 00 34 03

              RESPONSE : READER->HOST: 02 1D 00 3E FF 01 14 DF 78 11 A5 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F D8 03 //if i write hello worldworld i have to read that :

              02 1D 00 3E FF 01 14 DF 78 11 A5 hello worldworld D8 03 of course D8 03 will be changed

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

                Can you provide a link to the protocol you should use with that reader ?

                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
                • V Offline
                  V Offline
                  veysel.olgun
                  wrote on last edited by
                  #8
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    veysel.olgun
                    wrote on last edited by
                    #9

                    can you send me your email adress from private message because there is no it on website, i have a pdf sorry i am late to reply because i have no reputation

                    jsulmJ 1 Reply Last reply
                    0
                    • V veysel.olgun

                      can you send me your email adress from private message because there is no it on website, i have a pdf sorry i am late to reply because i have no reputation

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @veysel.olgun Don't ask others for their email address!
                      You can upload the document to some sharing service (drop box for example) and post the link here.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      2
                      • V Offline
                        V Offline
                        veysel.olgun
                        wrote on last edited by
                        #11

                        sorry for that, i will load dropbox

                        1 Reply Last reply
                        0
                        • V Offline
                          V Offline
                          veysel.olgun
                          wrote on last edited by
                          #12

                          https://www.dropbox.com/s/xb5uus6j8cu8juf/HOST-READER PROTOCOL v1.8. 15.03.2016 .pdf?dl=0

                          page number 14-17

                          thank you

                          1 Reply Last reply
                          0
                          • V Offline
                            V Offline
                            veysel.olgun
                            wrote on last edited by
                            #13

                            hello i solved the problem thank you all

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

                              What was it ?

                              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
                              • V Offline
                                V Offline
                                veysel.olgun
                                wrote on last edited by veysel.olgun
                                #15

                                it is about send to text data selected block and after take the text data selected block, actually if i show it it will be more understandable. i know it is easy to do but i was forced while converting.

                                (https://ddgobkiprc33d.cloudfront.net/2ff2c1a2-d1bd-4501-8519-8b81632ac359.png) i know ui is not good for now

                                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