аЯрЁБс>ўџ ACўџџџ@џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџьЅС` №ПM&bjbjЫsЫs 88ЉЉ!+џџџџџџЄ@@@@@@@Tx x x 8А $д T,ќ ќ ($ $ $ џ џ џ $,h”ЈЅ@џ џ џ џ џ Ѕ@@$ $ лКзззџ d@$ @$ зџ зз@@з$ № рPРЙ~OЦx cpза0з<г <з<@зЈџ џ зџ џ џ џ џ ЅЅsdџ џ џ џ џ џ џ TTT$x TTTx TTT@@@@@@џџџџ CS3224 Spring 2006 Term Project In Chapter 6 we discussed, among other things, linked allocation strategies, specifically FAT systems. This project is going to emulate the workings of a FAT-16 system. To review quickly, with a FAT system there is a directory that contains entries with a number of fields, including the name of the file and a pointer to the first FAT entry that corresponds to the first cluster allocated to the file. This entry is the head of a linked list, with an entry containing a hexadecimal FFFF indicating the end of the linked list. The directory itself should be initialized with filenames of blanks. If you initialize the directory properly, you can assume that if the first character of a filename is blank, the entire filename is blank, i.e. that a blank is not a proper first character for a filename. When a file is erased, the first character of the filename should be changed to a lower case Greek sigma (hexadecimal E5, decimal 229). The FAT-16 table will consist of two byte (short int) entries, and will contain 1000 entries. (Note: confirm that a short int is two bytes on your machine by running sizeof(short int), and getting a result of 2). Initially, entries 0 and 1 in the table should be marked with hexadecimal FFFF values, meaning that the first allocatable item will be Cluster 2. The rest of the FAT (entries 2 through 999) should be initialized to zero, indicating that the rest of the disk contains free clusters. The program will also have a root directory that can be up to 100 items long. Each entry in the directory will be a filename of up to 12 characters and a pointer to the first cluster for the file (an int). You do not have to use a C-style 12 character string for the filename if you don’t want to; you can use a C++ string class object instead. As described earlier, erased files will have a 0xE5 in the first character, and the first unused entry will be blank. In what follows, name means the filename involved. This is especially true for messages the program prints. In this context, “print” means any output that’s sent to cout. The program will read commands from cin and process them. Each command will consist of a keyword and a name. For some commands the name might be ignored in order to make all commands have the same syntax. The commands the program should handle are: NEW name This indicates that there is a new file. The program should check to see if the name is already in the directory, and if it is, print the following message: File name already exists If the name is not in the directory, the program should see if there’s room in the directory for the new filename. If there isn’t, the program should print the message: File name directory full Next, the program should scan the FAT from the beginning looking for an available cluster, indicated by a 0 entry in the FAT. If it does not find such an entry, it should print the following message: File name no space Otherwise, the program should allocate the cluster found to the file by adding the name to the directory, in the first available entry, setting the directory link to the entry number in the FAT, and marking that entry with a hex FFFF. The first available entry could be an entry with a 0xE5 as the first character, or a blank. EXTEND name This will make the file bigger by one cluster. First, the program should scan the directory looking for the name. If it can’t find it, it should print the message FILE name not found Otherwise, the program should use the FAT entry number in the directory entry to find the start of the file. The program will then read that FAT entry. If the entry is not a hexadecimal FFFF it will use that value to find the next cluster for the file, and continue until it finds a value of FFFF. Next the program scans the FAT from the beginning looking for an entry containing 0. If it doesn’t find one, it should print the message: File name no space Otherwise, it should change the value of the entry that had the hexadecimal FFFF to this entry number, and change the value of this entry from 0 to FFFF, effectively extending the file by one cluster. DELETE name First, the program should scan the directory looking for the name. If it doesn’t find it, the program should print the message: File name not found Otherwise, it should use the entry number in the directory entry to find the first cluster for the file. It should remember the value in that entry, and set the entry to zero. If the old value was not hexadecimal FFFF, it should use that as an entry number for the next cluster, and repeat this process until all the clusters have been freed. DUMP name First, the program should scan the directory looking for the name. If it doesn’t find it, the program should print the message: File name not found Otherwise, it should use the entry number in the directory entry to find the first cluster in the file. It should then print the name and the cluster number. If the cluster number is not FFFF, it should link to the next cluster and print its number until it sees a hexadecimal FFFF. The cluster numbers should be printed in decimal. The end of file marker should be printed as hex FFFF, i.e. not some weird decimal number. A sample output for a file called X.TXT would be: X.TXT 5 15 3 FFFF DUMP ALL This program will scan the directory for files, and dump them one by one, with one file per line, as described in the preceding command. It should stop printing when it sees a blank filename. Note that this means that you can’t have a filename of ALL. For this command, all the nonblank entries in the directory should be printed, including deleted files. END name This program causes the program to terminate. The name field is ignored. Any other command should generate a message of: Unknown command of x Where x is the illegal command you saw in the input stream. You can assume that even illegal commands still follow the syntax described above, i.e. that it will still have a filename following it. Note that you can use the normal cin operators to read the commands and operands. There will only be one command and operand per line to help make the file readable, but you do not have to worry about line breaks. You can just read in the two items as part of a loop. Comment It would be extremely helpful to you in debugging if you add a command DUMP FAT, which prints the first few entries of the FAT. This command will not be part of the project in order to avoid forcing you to match my output, but if your output doesn’t match mine this command will be extremely helpful in finding out what went wrong. To aid in this effort, you can assume that any input data that I prepare will not have FAT as a filename, essentially allowing you to consider FAT to be a reserved word, like ALL. Summary Note that this program only uses the files cin and cout. I will be using file redirection and test scripts when I’m grading the projects, so your output must match mine EXACTLY! I will put putting up test data inputs and outputs on MyPoly for you to use for comparison to insure that your program is working correctly. I will be testing your programs using Visual Studio.NET, so you should also use that system if possible. If you don’t know how to do this, instructions are posted on MyPoly. If you do use a different system, indicate this when you submit your project. All projects should be submitted via the MyPoly Digital Dropbox. There is no extra credit for early submission, but you are welcome to do so if you want to get the project out of the way. Multiple submissions are unacceptable. If you submit multiple times, you will get the grade of your final submission, divided by the number of times you submitted.      PAGE 2 of  NUMPAGES 3   НРЩт і   / t A З Ш Щ а г ъ э є љ ) . œ €ƒ…††‡˜œ,02VY”–—™+-4„ˆбекъёѕќјќєќ№ќьшьфьрмрирќиќфќфќфиќЪќиЦиќТВТВТќЪќиќиќЇЪќ—ќŒЇЪќ—hƒ!а5OJQJ^Jh­^[h%Ш5OJQJ\^Jh­^[5OJQJ^Jh­^[h­^[5OJQJ\^Jh­^[hXFthr)лh%Ш5OJQJ^Jh›i;hU4>h…t™hЈuЈhњ нhr)лhRbYhr/hšзh%Ш7 Щ/ Щ ‡2+4бъ“Ќt‡Юк}‘EX!-­СѓьььхххььььььоьььоооьььоьЄ№gd­^[Є№gd›i;Є№gd%Ш $ЄЄ№a$gdr)л!&L&§§ѕ"“ЌХtxy}‡яёqЭЮк}‚†‘EIJNX!-­ВЖС‚‰"01ЂЖа\]•ќјъјќпбЦбќТОТОќАТАЦАТЦАЦАТАТАЦАТЌОЌТœО˜ОœО””ОŒhЩ3e5OJQJ^JhЩ3ehЇoghЅWh+1Гh+1Гh­^[5OJQJ\^Jhr)лhr)лhМwј5OJQJ^Jh­^[hМwјh­^[5OJQJ^Jhr)лh%Ш5OJQJ^Jhƒ!а5OJQJ^JhКEШhКEШ5OJQJ^JhКEШh%Ш0"ЂЖ]ЁЊ`Ѕjv ~ Ъ!~"†"Х#С$!&#&$&&&јјјјјјјјјёёёёёшёёпёиижжжЄ№gdƒ!аЄЄ№gd+1ГЄЄ№gdY~‹Є№gd+1ГЄ№gd%Ш•ЁЊ2ЁЄЅ `Ѕv } ~ ~"†"Б"Д"Й"Н"!&"&$&%&'&(&*&+&-&.&4&5&ёснйЫйЧнЙЕБЃБœ’Ž„йtйtйlhlhlhlh^X^ hЌKF0JjhЌKF0JUh';†jh';†Uh+1Гh+1Г5OJQJ\^Jh+1Гh+1Г6]hY~‹hY~‹hY~‹6] hY~‹6]hXFthXFt5OJQJ^JhXFthr)лhr)лhr)л5OJQJ^Jh’[6hƒ!аh+1Г5OJQJ\h+1Гh­^[h+1Гh­^[5OJQJ\^JhЩ3ehЩ3e5OJQJ^J!&&'&)&*&,&-&J&K&L&M&§§§§§ѕ§§юЄ№gdƒ!а$a$gdњ н 5&6&7&;&<&F&G&H&I&K&L&M&єъфъфъйъебЭh+1Гh';†hЌKFhЌKF0JmHnHu hЌKF0JjhЌKF0JUhŒtЎ0JmHnHu 6&P1h:pЌKFАа/ Ар=!Аа"Аа#а$а%ААаАа а†œ@@ёџ@ NormalCJ_HaJmH sH tH Z@Z r)л Heading 1$Є№Є<@&5CJ KH OJQJ\^JaJ \@\ +1Г Heading 2$Є№Є<@& 56CJOJQJ\]^JaJDA@ђџЁD Default Paragraph FontRiѓџГR  Table Normalі4ж l4жaі (kєџС(No ListH™ђH DE Balloon TextCJOJQJ^JaJ4@4 њ нHeader  ЦрР!4 @4 њ нFooter  ЦрР!.)@Ђ!. њ н Page NumberM8џџџџ Щ/Щ‡2+ 4 б ъ “ Ќ t ‡ Ю к } ‘ EX!-­С"ЂЖ]ЁЊ`Ѕjv~Ъ~†ХС!#$&')*,-JKN0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€0€€˜0€€˜0€€0€€˜0€€˜0€€˜0€€hЫ0Иh‹0šhЫ0Иh‹0šhЫ0Иh‹0šhЫ0Иh‹0š@0€€hЫ0Ÿh‹0pš ***-ѕ•5&M&&&M&L& %'-!џ•€џ•€№8№@ёџџџ€€€ї№’№№0№( № №№B №S №ПЫџ ?№=A!!##$$&')*,-KNov3j!!##$$&')*,-KN3+ 4 “ Ќ Ё3iv~!!##$$&')*,-7;KN=A!!##$$&')*,-KN$х#Ж ќ Fr/’[6›i;U4>DEџEЌKFЅWRbY­^[4IdЩ3e|$gЇogXFtC?ўџџџ§џџџBўџџџўџџџўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџRoot Entryџџџџџџџџ РFа ХЙ~OЦD€Data џџџџџџџџџџџџ1Tableџџџџ%<WordDocumentџџџџ88SummaryInformation(џџџџџџџџџџџџ0DocumentSummaryInformation8џџџџџџџџ8CompObjџџџџџџџџџџџџqџџџџџџџџџџџџўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўџ џџџџ РFMicrosoft Office Word Document MSWordDocWord.Document.8є9Вq