Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write program redact.c that reads entire lines from the user, and hides certain words according to a list of words received as program arguments, as

Write program redact.c that reads entire lines from the user, and hides certain words according to a list of words received as program arguments, as illustrated in the following example.

the following requirements should be met.

Here are a list of requirements, assumptions and hints:

1.This program shall contain no global variables.

2. We assume that the maximum number of characters a line can contain is 80.

3. Censored words less than 2 characters should be ignored.

4. You will probably need to split the problem into a hierarchy of functions. A possible set of functions could include:

5. A function that hides a certain number of characters in a line, starting from a given position.

6. A function that hides a certain word in a line (e.g. by iterating through the string and locating the word).

7. A function that hides a collection of words in a line.

8. The main function should be the brain, reading the line from the user and calling the censor function before displaying the censored line.

In order to match strings while ignoring their case, you can use strncasecmp() function provided by the libc.

USEFUL FUNCTIONS----

List of some important libc functions that are used in the reference program: strlen(), strncasecmp(), fgets().

The example of execution is shown below---------

image text in transcribed

cat udhr_art26.txt (1) Everyone has the right toe free, at least in the elementary and fundamental stages Elementary education shall be compulsory. Technical and professional education shall be made generally available and higher education shall be equally accessible to all on the basis of merit. (2) Education shall be directed to the full development of the human personality and to the strengthening of respect for human rights and fundamental freedoms. It shall promote understanding, tolerance and friendship among all nations racial or religious groups, and shall further the activities of the United Nations for the maintenance of peace. (3) Parents have a prior right to choose the kind of education that shall be given to their children. ./redact education right t

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Upgrade Migration And Transformation Tips And Techniques

Authors: Edward Whalen ,Jim Czuprynski

1st Edition

0071846050, 978-0071846059

More Books

Students also viewed these Databases questions