Simple text editor using c programming in linux environment


Assignment: Simple Text Editor using C programming in Linux Environment

The main goal of this assignment is to assist you practice in c programming. A tutorial on Linux commands and c programming is given at the end of assignment.

Resources or illustrations of c programming are given in Moodle.

Description:

In this assignment, you will encompass the opportunity to write a simple text processing program with all the essential functions (open and save text documents, insert and delete text and search for words). A MENU will be employed that will help users perform such operations. We suppose that text read from a file is stored in an array till the file is saved.

You are needed to employ the c programming language (not C++) and employ the std library functions or write the function yourself which implements operations or features of a simple text editor.

Note that all such functions will be implemented in one c program file.

Programming Requirements:

1) Write a C program to open and close a file given its name. Your program should check whether or not the file exists.

2) Add up a function for reading an opened file into an array of characters. You might suppose the array is large adequate to hold a whole file (example:  100,000 characters).

3) Add up a function for saving the text stored in an array to a file. Your program should check whether or not the output file already exists, and if it does your program should ask the user whether he or she wishes to overwrite the file.

4) Extend your program to count the number of words and characters in the text file. An algorithm for counting words which is given in the textbook.

5) Add up a function for inserting a string into the array. Insertion is done through providing a start position and a string.

6) Add up a function for deleting strings from the array. Deletion is done by providing a start position and the length of string to be deleted.

7) Add up a function which searches the text for a pattern. Show all the occurrences of a string.

8) Add up a function to substitute all the occurrences of a string with a new string. Note that this operation is a combination of search, delete and insert operations.

Once all the functions have been implemented, you must design a menu which is used for informing users about selection. “Pico” text editor in Linux is a good illustration.

Additional Problem:

Extend your program to permit all operations performed as the last save to be undone in the reverse order in which they were executed. For illustration, a command‘d 3 4’ which deleted the string “abcd” from position 3 is undone by a command ‘i 3 abcd’ which will insert the string “abcd” at position 3. You will require a stack to save the undo operations that might be performed.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Simple text editor using c programming in linux environment
Reference No:- TGS0585

Expected delivery within 24 Hours