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. hex converting

hex converting

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
22 Posts 6 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.
  • N NewHSKid

    My friends dad gave me a program to write cause he said it will make me learn. I have to connect to a server and send it 4 byte messages that have the form of 5FF00239. The message changes though, because the window (dialog i think its called) has 2 check boxes. If only the first check box is checked then the message should be 5FF00239 and if the second check box is only check it should be 5FF0023A. But if both are checked then he wants the message to be 5FF0023B. How do I make these messages? I don't know what type they should be. I can do everything else he wants except i don't know how to do the message. I thought it would be a string, but he says if it is, then the message is 8 bytes instead of 4? Please help me...

    K Offline
    K Offline
    Ken Mazaika
    wrote on last edited by
    #21

    Windows Sockets can be highly complicated as well as windows programming for people somewhat new to programming. From your posts it seems as if your skipping quite a few steps in the learning process. I think if you ended up writing a program that does what you want now it will be mostly cut/paste code and you won't get much out of the experience. This program would be an excellent learning experience, but you should make creating it more of a long range goal.

    1 Reply Last reply
    0
    • N NewHSKid

      but I only need 4 bytes? should i change the 32 to 4 then? Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

      T Offline
      T Offline
      Terry ONolley
      wrote on last edited by
      #22

      The only actual "numbers" in the computer are semi-conductor gates that are either on or off. That is fine for the computer, but most people need something visual to help us understand what is going on. To the computer, all numbering base sytems look the same - binary. It is only when outputting the graphical representation of those numbers that you need to worry about data types and base. So, the number 255 is represented in the coputer by 8 logic gates being on: 11111111 If you, the human, wants to see that number in hexadecimal, then you tell your program to format that number in base 16 and you see "FF". Now, the characters "FF" are represented by the ascii code for the letter 'F' - which is 70 or x40 - so if you looked at the raw bits for the characters "FF" you would see 70 70 or the bits 01000110, 01000110. So what happened??? You started with 11111111 and ended up with 01000110, 01000110! The confusion comes from figuring out what format the reciever of the data is expecting. That is what function headers are for. They define how to interperet the bits that are being sent.



      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