1. Ummm, ok this is a dumb question maybe, but how do i break down a file into binary. As in 10101010.

Is it possible to covert characters into binary as in make A = 111000
whatever

How about ascii to hex, then binary?

Any suggestions are appriciated. Thanks

2. To get the binary value just easiset way is to first convert any variable you have into byte or byte array, from strings with Strconv(), one char strings with asc() integers or floating points with copymemory, and opening a file in binary.

Then to check for each bit in a byte you use and operator:
Code:
```For Bit = 0 to 7
debug.?cbool(ByteArr(X) And 2^Bit)
next Bit```
To convert to Hex use Hex() function

3. ## Binary

Ultimately ALL data is stored as a binary representation. Although you could simply represent each character you want with a stream of binary characters and then write that to a file, this would be pretty inefficient. I remember, long ago, reading an essay on cryptography which represented files with binary numbers only. The key was to set the file to read eight characters at a time, say, and this was then used as a code to tell the program how to interpret the next n characters.

To represent characters or numbers in binary you need to define a storage area and then use some of that as flags to indicate the data type and other properties. Try looking up Binary Coded Decimal for an example of representations of numbers in binary - the key thing to realise is that the interpretation of a binary stream can be representative of anything you like - you just have to set up the code and decoding mechanisms. At its most basic level that is what an OS does when it translates what we type at a keyboard - a computer does not understand A or B - it merely recieves a stream of binary data.

Phew.

Clear as mud, I am sure.

As to how to break down a file into Binary - hmmm write out ASCII codes as a fixed length Binary Stream - maybe.

"This255" would be 01010100 01101000 01101001 01110011 00110010 00110101 00110101

However it gets complicated here because do you interpret the last three codes as 255 (two hundred and fifty five) or 2,5,5?

See the hot water you are getting into...

Cheers.

Paul.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•