Simple text editor using c programming in linux environment, C/C++ Programming

Deliverables: you are required to upload your c code in the assignment dropbox set in Moodle. You are supposed to work with Linux gcc compiler and pico editor for compiling via the command line in the Linux terminal. In the beginning, you can use Dev C++ or Eclipse IDE - CodeBlocks since your Linux server is being setup. Note that c programming has a filename.c extension (not .cpp). You should make a directory called "Assignment_1" in your 'home' directory of you Linux server account. In this directory, you can have your c code and accompanying files. Note that the code in your Linux server will be graded in your lab from your presentation.

scription

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

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

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

Programming Requirements

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

b. Add a function for reading an opened file into an array of characters. You may assume the array is large enough to hold an entire file (e.g. 100,000 characters). 

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

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

e. Add a function for inserting a string into the array. Insertion is done by providing a start position and a string

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

g. Add a function that searches the text for a pattern. Show all occurrences of a string.

h. Add a function to replace all 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 should design a menu that is used for informing users about selection. "Pico" text editor in Linux is a good example.

Extra Credit Problem:

i. Extend your program to allow all operations performed since the last save to be undone in the reverse order in which they were executed. For instance, 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 need a stack to save the undo operations that may be performed.

Posted Date: 3/6/2013 5:21:39 AM | Location : United States







Related Discussions:- Simple text editor using c programming in linux environment, Assignment Help, Ask Question on Simple text editor using c programming in linux environment, Get Answer, Expert's Help, Simple text editor using c programming in linux environment Discussions

Write discussion on Simple text editor using c programming in linux environment
Your posts are moderated
Related Questions

c-program to find the area under the curve y=f(x) between x=a and x=b integrate y=f(x) between the limits of a and b   #include float start_point, /

Write a program to add co-ordinates of the plane The class having x and y co-ordinates. Create three objects. Use a constructor to pass one pair of co-ordinates and a funct

what is binary heap ? what is the c code for the implementation for the binary heap

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

WAP TO ACCEPT THE BASIC SALARY OF EMPLOYEES & CALCULATE NET SALARY   #include stdio.h> #include conio.h>   void main() {                    float Basi

Is it possible to pass an entire structure to functions? Yes, it's possible to pass an entire structure to a function in a call by method style. Some programmers prefer to decl

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of t

This assignment builds on Homework 3. The two major modifications are the instruction of pointers and the calculation of mortgage interest rates. Requirements for Project 2:

Write a program that illustrate  Macros with Arguments? Macros is able to also have arguments, just as functions can. #define AREA(x)(3.14*x*x) Then at any time the prepr