Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Summary Write a program which manipulates text from an input file using the string library. Your program will accept command line arguments for the input

Summary Write a program which manipulates text from an input file using the string library. Your program will accept command line arguments for the input and output file names as well as a list of blacklisted words. There are two major features in this programming

1. Given an input file with text and a list of words, find and replace every use of these blacklisted words with the string REDACTED . You are essentially creating a tool for redacting, or censoring, blacklisted words. Think of the classified government memos with the important bits blacked out.

2. Given the same input file, report the number of characters and then number of words present in the text.

functionality:

1. Accept command line parameters for the following a) Input file name b) Output file name c) List of black listed words to be remove from the input file text See the Input/Output Requirements section for details on the format of your program inputs

2. The censoring functionality has the following requirements a) The text to censor is read from the input file specified on the command line. Use the readFromFile() function provided to do so b) In this text, look for and replace every instance of the blacklisted words provided on the command line with the word REDACTED c) Write the censored text to the output file specified on the command line.

Use the writeToFile() function provided to do so

You can assume following

There will be no more than 20 blacklisted words input on the command line There will be no more than MAX_CHAR_COUNT/2 number of characters in the input file. This constant is specified in the fileUtils.h file

3. Before censoring the text from the input file a) Find the number of characters in the text (this includes spaces, newlines, or any valid character). Write the results to output file. b) Find the number of words in the text and write the result to the output file

4. You must use functions from the string library to manipulate the text

5. Your program must be split up into multiple files a) A .c file with all manipulation and count related function implementations b) A .h file with all macros and function definitions for the above .c file c) A .c file that contains your main and any other functions

6. A makefile to compile your program a) All of your source files should be compiled with c99 and the -Wall option b) An example will be provided The following string library functions could be useful strlen strcpy strncpy strcat strncat strtok strstr You will need to include the fileUtils.h file in your code wherever you use the readFromFile() and writeToFile() functions You can use a diff tool to compare the file output from your program to the expected, correct output. There is a diff command available on linux.

Input/Output Requirements:

1. The syntax for running your program should be programName input.txt output.txt word1 word2 word3 input.txt - File containing text to be censored output.txt - File where censored text and counts are written word1 word2 - The words that should be censored from the input text

2. The format of the output file should adhere to the following standard CHARACTER COUNT WORD COUNT CENSORED TEXT Each of these items is started on a new line. The censored text should have the same format as the original text, with only the blacklisted words being replaced with REDACTED

#include "fileUtils.h"

#include"strManip.h"

int main()

//You need to add main function parameters to get command line arguments

{

}

____________

#include

"strManip.h"

//implement your string manipulation functions here

//remember to use the string library functions!!

_______________

#ifndef STRMANIP_H

#define STRMANIP_H

//place your string manipulation function declarations here

//then implement the functions in strManip.c

#endif //STRMANIP_H

WIll RATE!

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago