The assignment is about compiling multiple files. You should have more than three files with whatever names you want. There is one header file. For example, main.c, getfilename.c, readfile.c, ..., and vi.h. Each file contains just one function.
1. The program starts by printing your name with an end sign ">". For example, "Name>";
2. Then, you can type in a string. If the string is not "vi xxx", you print "I don't know this command." You keep getting a string until you get a string starting with "vi". For example, "vi myp.c". Your program will then open "myp.c" for reading. If the file does not exist, then there is nothing to read.
3. Read the file into a fixed array of "mytext[1000][ 81]". Presumably, the "myp.c" text file is not too large with each line 80 characters or fewer. If there are more characters than 80 in a line, you can just ignore the characters beyond 80.
4. Close your file.
5. Change all your texts to upper case, and display the first 20 lines on your screen.
6. Then, your program will wait for a command from the keyboard.
7. If you type ":w", your program will open the same file for writing, and write your array of text into that file.
8. If you type ":q!", your program will quite.
9. If your type ":w myp1.c", your program will open "myp1.c" and write into that file. You should always close your file after finish.
Remember to use function calls instead of a program of one function. Each function should be shorter than two pages.
10. Display one special character as the cursor using ascii code "@" at the position of mytext[0][0].
11. Replace Step 5. "Change all your texts to upper case" with "Display 20 lines from the current line on the screen". The current line is where you start displaying lines of texts. It's original value is zero, but it can be modified by the cursor moving out of the 20-line frame.
12. You can use "j" to move the cursor down one line, "k" up one line, "h" left one character, and "l" right one character. Of course, if there is no place to move left, right, up, or down, the cursor just stays. Because you moved the cursor, you need to clear the screen and then display again with the new cursor position. system("clear"); will be able to clear the screen.