Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C PROGRAMMING In this project, you are to develop a simple console app to manage

ID: 3824969 • Letter: C

Question

C PROGRAMMING

In this project, you are to develop a simple console app to manage a list of things to do; it is similar to the Todo web app at: http://todomvc.com.That is, the Todo app manages a list of entries. Each entry consists of: (a) a textual description and (b) a status of either active or completed. The app provides several operations to:

(1) Add a new entry,

(2) Edit the description of previously entered entry,

(3) Toggle the active/completed status of an entry,

(4) Delete an entry

(5) Delete completed entries.

(6) change the app list display mode to display:

(A) All entries

(I) Only active entries

(C) Only completed entries.

Since this is a console app, it is menu-based instead of the interactive user interface of Todo.The menu system is best described using a running demo of the app input/output below (when the app is started, it loads and displays the saved todo list in todo.txt file, if the list is empty:

I have questions on the FILE commands...

1) If I append a file does it create the file if it doesn't exist like writing a file would?

2) What would be the full command to search for specific entries in the File

3) How would I go about rearranging the file using C programming? Just rewrite the whole file?

4) Is there a way to store the entries as variables in the program so I could sort them easier... if so how... if I don't know how many variables there are

Explanation / Answer

Do you need a program or the answers to your questions? I'm assuming that you need only answers to the questions you asked.

1) Yes. If you open a file with append mode, it will create a file if doesn't exist. Simply give the following line

fopen(Filename,"a+");

2) To search for a specific entry in the file, you need to user strstr() to search.

First read the file line by line using getline() method and search using like this

strstr(line,entry)!=NULL;//Present

3) I didn't get you. Rearranging means? Are you saying like just jumbling the lines in the file in your own order and writing it into the file? If so you have to read the complete file into an array of strings (line by line) and write each string randomly into the file.

4) Yes. You can store the entries as variables in the program and sort them. Just read the entries into an array and sort them and write them back to the file.