Hey guys what would be the easiest way of converting binary to ascii?
Hey guys what would be the easiest way of converting binary to ascii?
Sorry could someone explain bit more about bit shifting as i dont fully understanf this
Let's take the binary number 11001101 (that's 203 in decimal). If you bitshift left one (that is, have Number << 1), the bits become 10011010. Here's a pictorical view with alignments:
The area between the | and | indicates what is being used. Those outside it are discarded (or converted to zeros). That's the general idea. This demonstrates 8-bit, but it works the same no matter how many bits you use, even 1,048,576 (provided there was a data type that big).Code:00|11001101|00 // original 01|10011010|00 // number << 1 11|00110100|00 // number << 2 00|01100110|10 // number >> 1 00|00110011|01 // number >> 2
I'm pretty sure that there are some special indications for C (such as getting printf to print the binary representation of the decimal number 168). I, unfortunately, don't know it. There's one for octal and hexadecimal as well.
High elevation is the best elevation. The higher, the better the view!
My computer: XP Pro SP3, 3.4 GHz i7-2600K CPU (OC'd to 4 GHz), 4 GB DDR3 RAM, X-Fi Platinum sound, GeForce 460, 1920x1440 resolution, 1250 GB HDD space, Visual C++ 2008 Express
What don't you understand about it? It's pretty straight forward... << shifts numbers left, >> shifts numbers right.
But that has nothing to do with binary to ASCII conversion. There's no conversion that needs to take place at all. The ASCII table is just an ordered group of number values. You can represent a given character in a number of ways, including binary.
Maybe this will help: http://www.catb.org/~esr/faqs/smart-questions.html
If you understand what you're doing, you're not learning anything.