convert string of binary to Char

This is a discussion on convert string of binary to Char within the C Programming forums, part of the General Programming Boards category; Dear experts, May I ask how can I convert a string of binary eg "01100000" into a character type which ...

  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,211
    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, 12:59 PM
  2. OOP Question DB Access Wrapper Classes
    By digioz in forum C# Programming
    Replies: 2
    Last Post: 09-07-2008, 05:30 PM
  3. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 10:42 PM
  4. String Class
    By BKurosawa in forum C++ Programming
    Replies: 117
    Last Post: 08-09-2007, 02: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, 03:20 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21