Friday, April 20, 2007

I know i can count, but i'm not sure about my mac

So in a moment of boredom, i opened up my trusty text viewer, and had a look at some files. Namely a RTF, and a Text File.

First off, i now understand why programmers love plain text files so much. First off, there are no bytes wasted on headers. It's straight into the data, no messing and no playing.

So here is the test stub

## Coursework mass compilation

cd ~/Desktop/OOTM






## Run the application

##java CardGame

This was a little bash script i wrote to help compile my coursework.
Not to remember the basics, each character is equal to a single byte, or 8 bits. FF is therefore equal to 255.

The plain text file is 8KB, with 204 characters. My maths tells me that should be equal to 204 bytes. But for some reason, my mac accounts another 1300 + bytes!!

Mean while the Rtf file is 4KB, with 561 bytes, which is the exact number of characters in the file. But wait you say, there are only 204 characters in the file. Correct, so whats the other junk ....
{\fonttbl\f0\fswiss\fcharset77 Helvetica;}

\f0\fs24 \cf0

I only went through it briefly, but it appears to show the font types, and colors for the file.

But my question to the world is, why on earth is the text file twice the size, but yet still halve the number of bytes in the hex editor?

No comments: