0

this is the problem

Write a complete C program that can be used as a simple line-oriented t-xt editor. This program must

have the following capabilities:
(a) Enter several lines of text and store in a data file.
(b) List the data file.
(c) Retrieve and display a particular line. determined by line number.
(d) Insert n lines.
(e) Delete n lines.
(f) Save the newly edited text and end the computation.

Carry out each of these tasks in response to a one-letter command, preceded by a dollar sign ($1. The
find (retrieve) command should be followed by an unsigned integer to indicate which line should he retrieved.
Also, the insert and delete commands can be followed by an optional unsigned integer if several consecutive
lines are to be inserted or deleted.
Each command should appear on a line by itself, thus providing a means of distinguishing commands
from lines of text. (A command line will always begin with a dollar sign, followed by a single-letter command,
an optional unsigned integer, and a newline designation.)

The following commands are recommended:
SE --enter new text
SL -list the entire block of text
SPk-find (retrieve) line number k
$In-insert n lines aher line number k
SDn-delete n lines after line number k
SS -save the edited block of text and end the computation

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Ancient Dragon
0

>>how can i solve the data files's problem

By writing the program of course :) What have you already written? What don't you understand about the instructions?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.