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. Decimal To Binary Conversion and Vice-versa
QtWS25 Last Chance

Decimal To Binary Conversion and Vice-versa

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 7.6k Views
  • 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.
  • Pranit PatilP Offline
    Pranit PatilP Offline
    Pranit Patil
    wrote on last edited by
    #1

    Im searching Decimal To Binary Conversion function and Vice-versa in Qt.
    if any one known please help me.
    Thank You.

    @Embedded Software Developer
    God has given you one face, and you make yourself another.

    JonBJ J.HilkJ 2 Replies Last reply
    0
    • Pranit PatilP Pranit Patil

      Im searching Decimal To Binary Conversion function and Vice-versa in Qt.
      if any one known please help me.
      Thank You.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Pranit-Patil
      https://stackoverflow.com/a/45343255/489865

      1 Reply Last reply
      2
      • Pranit PatilP Pranit Patil

        Im searching Decimal To Binary Conversion function and Vice-versa in Qt.
        if any one known please help me.
        Thank You.

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @Pranit-Patil
        there's always the standart c++ libary

        https://en.cppreference.com/w/cpp/utility/bitset/bitset


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        2
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4
          This post is deleted!
          JonBJ 1 Reply Last reply
          1
          • VRoninV VRonin

            This post is deleted!

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • Pranit PatilP Offline
              Pranit PatilP Offline
              Pranit Patil
              wrote on last edited by Pranit Patil
              #6

              I got this and its works fine for me

              #include <QCoreApplication>
              #include <QDebug>
              #include <QString>
              int main(int argc, char *argv[])
              {
              QCoreApplication a(argc, argv);
              bool ok;

              QString str = "FF";
              qDebug()<<"Input (HEX)       = " << str;
              
              int iVal = str.toInt(&ok,16);
              QString binnumber = str.setNum(iVal, 2);
              
              qDebug()<<"Convert to Int    = " << QString::number(iVal);
              qDebug()<<"Convert to Binary = " << binnumber;
              
              return (0);
              

              }

              @Embedded Software Developer
              God has given you one face, and you make yourself another.

              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