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

Decimal To Binary Conversion and Vice-versa

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 7.7k 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.
  • P Offline
    P Offline
    Pranit Patil
    wrote on 28 Sept 2018, 12:58 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.

    J J 2 Replies Last reply 28 Sept 2018, 13:12
    0
    • P Pranit Patil
      28 Sept 2018, 12:58

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

      J Offline
      J Offline
      JonB
      wrote on 28 Sept 2018, 13:12 last edited by
      #2

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

      1 Reply Last reply
      2
      • P Pranit Patil
        28 Sept 2018, 12:58

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

        J Offline
        J Offline
        J.Hilk
        Moderators
        wrote on 28 Sept 2018, 13:13 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
        • V Offline
          V Offline
          VRonin
          wrote on 28 Sept 2018, 14:27 last edited by
          #4
          This post is deleted!
          J 1 Reply Last reply 28 Sept 2018, 15:01
          1
          • V VRonin
            28 Sept 2018, 14:27

            This post is deleted!

            J Offline
            J Offline
            JonB
            wrote on 28 Sept 2018, 15:01 last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • P Offline
              P Offline
              Pranit Patil
              wrote on 29 Sept 2018, 12:20 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

              1/6

              28 Sept 2018, 12:58

              • Login

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