|UMBC CMSC 201 Spring '03||CSEE | 201 | 201 S'03 | lectures | news | help|
Out: Monday 4/14/03
The design document for this project, design4.txt ,
Your project is to get the name of the file as a command-line argument, read in the contents of the file, and translate it from English into Morse code. Your program should also report the total number of characters in the file, print the contents of the file, report the number of spaces, punctuation marks, and the number of other non-alphabetic characters that exist in the file.
Your project MUST contain the two functions called ReadFile() and CountNonAlpha() that I've specified the prototypes and described below. You may not alter these prototypes in any way. You will certainly need to have other functions as well.
You should have a variable in main called string and ReadFile() should modify that variable so that it will contain the address where the string is being stored in memory (the space you malloced). You should also have a variable in main() called length and ReadFile() must modify that variable so that it will contain the number of characters read (the length of the string).
When printing the Morse code translation of the sentence, separate the code for each letter with a space. Each word should be shown on a separate line. All other non-alphabetic characters that occur in the string should be ignored when translating it into Morse code.
The file to use for this project is called morse.txt. The executable and the data file need to be in the same directory in order for the program to run properly. As in the previous project, you should get a copy of this file by using the Unix cp command shown below.
cp /afs/umbc.edu/users/s/b/sbogar1/pub/morse.txt .
You must use separate compilation for this project. You may have as many .c and .h files, as you see fit.
Use the submit command to submit your files as in previous projects. Make sure you submit all files necessary for your project to compile, including your header file(s).