CIS3355:
Business Data Structures |
What are ASCII Files?? Wait!! This is dumb question! All files are ASCII files, aren't they?? No, as a matter of fact, there are very few ASCII files, as opposed to non-ASCII files. According to Webopedia an ASCII file is:
What?? Let's first take a look at what a text file is. Suppose I wanted to store the phrase: "Hi, Mom". We already know that each character has a unique bit sequence associated with it. In this case, we would store the phrase (in binary) in a text file as:
(Check the bit sequences in the ASCII table provided) If we were writing this information to an ASCII file, we would store the binary sequences (in order) as: 0100100001101001001011000010110000100000010011100110111101101101 Where each eight bits (from left to right) represents the character being stored. So?? How is that different that how a Microsoft Word file might save them? I am not sure (exactly) how a Word package might save the data. However, it is obvious that Word saves a lot more information. For example, Word has to save information like Margins, fonts, line spacing, etc. Do you see any of these specifications in the ASCII Table (even in the Extended ASCII Character set??) Obviously, our friends at Microsoft have their own scheme for storing data retrieving it and analyzing it. They can't store data using 8-bits, since they need to store more than 256 (As we know, 28 = 256 combinations) messages. For the sake of argument, let's assume that they would store this information as: Font, Font Size, string (i.e., "Hi, Mom"), endstring Each of these components might require 32-bits of storage (232 = 4,294,967,296; a fair number of messages). Let's again assume that the sequence of bits needed to store all of this information would be:
011000101011010101011000000110101101010101010101001111000000000000000000000000100 (using 320 bits, since each component requires 32-bits; don't bother trying to figure out the sequence; I've made most of it up) Now, if we try and read this as if it were an ASCII file, we would take 8-bits at a time (from left to right) and analyze the sequence as:
And so on. This is (essentially) what you would see if you were to try and display contents of a Word, or Excel, or any other non-ASCII file using an ASCII Text editor. (Try it! Use an ASCII Text Editor, Such As Notepad, to open up a Word or Excel File and see what happens) So what type of files are these non-ASCII files? once again, our friends at Webopedia provide us with this definition:
What??? Basically, the users of a binary file know how to interpret the sequence of bits. We don't. You can do that??? That's what data structures are all about. Some good references include: At this point in time, you should be able to Answer the following questions:
[A binary file is] A file stored in binary format. A binary file is computer -readable but not human-readable. All executable programs are stored in binary files, as are most numeric data files. In contrast, text files are stored in a form (usually ASCII) that is human-readable. a. A text file b. A binary file c. Either a Text file or a binary file d. A file that reads 7-bits at a time (i.e., the standard ASCII Character set) e. None of the above Answer: a a. Read 7 bits at time b. Read 8 bits at time c. Read bits as specified d. None of the above e. All of the above Answer: b a. A text file b. An ASCII file c. Either a Text file or an ASCII file d. A file that reads 7-bits at a time (i.e., the standard ASCII Character set) e. None of the above Answer: e a. Read 7 bits at time b. Read 8 bits at time c. Read bits as specified d. None of the above e. All of the above Answer: c
|