Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. check value of a bit in byte

check value of a bit in byte

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 Posts 4 Posters 0 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.
  • K Offline
    K Offline
    kani98
    wrote on last edited by
    #1

    How do I check to see if the 8th bit in a byte is set to a 1 or 0? Thanks

    W T 2 Replies Last reply
    0
    • K kani98

      How do I check to see if the 8th bit in a byte is set to a 1 or 0? Thanks

      W Offline
      W Offline
      Waldermort
      wrote on last edited by
      #2

      Use the bitwise '&' operator. BYTE mybyte = 0x80; if ( ( mybyte & 0x80 ) != 0x00 )

      1 Reply Last reply
      0
      • K kani98

        How do I check to see if the 8th bit in a byte is set to a 1 or 0? Thanks

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        This article[^] was written for you :cool:


        Don't know where to start ?
        Refer the Forums Guidelines and ask a friend

        [VisualCalc 3.0][Flags Beginner's Guide]

        M 1 Reply Last reply
        0
        • T toxcct

          This article[^] was written for you :cool:


          Don't know where to start ?
          Refer the Forums Guidelines and ask a friend

          [VisualCalc 3.0][Flags Beginner's Guide]

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          And I thought it was written for me :((

          T 1 Reply Last reply
          0
          • M Mark Salsbery

            And I thought it was written for me :((

            T Offline
            T Offline
            toxcct
            wrote on last edited by
            #5

            lol, no Mark, you're not a beginner AFAIK. but if you consider yourself to start with bitwise stuff, then yes, you're all understood to bookmark it :rose:


            Don't know where to start ?
            Refer the Forums Guidelines and ask a friend

            [VisualCalc 3.0][Flags Beginner's Guide]

            M 1 Reply Last reply
            0
            • T toxcct

              lol, no Mark, you're not a beginner AFAIK. but if you consider yourself to start with bitwise stuff, then yes, you're all understood to bookmark it :rose:


              Don't know where to start ?
              Refer the Forums Guidelines and ask a friend

              [VisualCalc 3.0][Flags Beginner's Guide]

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              Awww thanks man! :)

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups