Thread: convert string of binary to Char

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    7

    convert string of binary to Char

    Dear experts,

    May I ask how can I convert a string of binary eg "01100000" into a character type which is a?

    Thank you in advance

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    This does sound like an assignment question, so I'm not going to post a direct answer [and even if it isn't, you'll learn a whole lot more by solving it as an assignment where you do the work, and we give you hints].

    By the way, 'a' is 01100001 in binary (using ASCII or related character set).

    So have you got any idea on how to work this out?

    How would you do it if you had a pen and paper and an ASCII table with the values in decimal [e.g. 97 'a']?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Here's a hint: Once you have the string converted to a numeric equivalent, you've got the answer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 11
    Last Post: 06-16-2011, 11:59 AM
  2. OOP Question DB Access Wrapper Classes
    By digioz in forum C# Programming
    Replies: 2
    Last Post: 09-07-2008, 04:30 PM
  3. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 09:42 PM
  4. String Class
    By BKurosawa in forum C++ Programming
    Replies: 117
    Last Post: 08-09-2007, 01:02 AM
  5. How to Convert a byte datatype to char or string
    By kvp_vivek in forum C Programming
    Replies: 3
    Last Post: 06-17-2006, 02:20 PM