Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//wwucat.c #include #include #include #include #define BUF_SIZE 32 /* Size of buffer */ #define FILE_NAME_LEN 200 /* Maximum length of file name */ int main(int

image text in transcribed

image text in transcribed

//wwucat.c

#include

#include

#include

#include

#define BUF_SIZE 32 /* Size of buffer */

#define FILE_NAME_LEN 200 /* Maximum length of file name */

int main(int argc, char *argv[])

{

//Start Solution

return;

}

//part1.txt

29th May is officially

//part2.txt

Put a Pillow on Your Fridge Day.

Requirements You will write a program (wwucat) which will perform the following functions. It will run from the command line as shown below: > ./wwucat [filename2 ... filenamen] This will concatenate the contents of filename1, filename2,..., filenamen. Output will be printed on the standard output. If there is an error when the file is opened for reading, print the message "Error opening the file for reading", and continue concatenating the next file if applicable. If an error occurred while reading the file, print the message "Error while reading the file", and continue concatenating the next file if applicable. If there is an error writing to the standard output, print the message "Error while writing to standard output", and continue concatenating the next file if applicable. Similar to cat, wwucat can concatenate more then 2 files. Arguments: 1. Expects at least 1 argument as the file name. If not provided, print the message "Expecting 1 filename" Instructions 1. Download the zipfile 2. Your implementation file MUST be named wwucat.c 3. Implement the code for the functions described in the requirements 4. Use system calls e.g. open, read, write, and close functions. Do not use ANSI C functions e.g., fopen. 5. Test the code using the given text files 6. Check the results to make sure there are no failures. Sample output for concatenating the files part1.txt and part2.txt using the command ./wwucat part1.txt part2.txt 29th May is officially Put a Pillow on Your Fridge Day. Submission Submit your code wwucat.c to a directory named midterm in your git respository. Grading scheme Clean build, no warnings (10) Correct handling missing argument and incorrect command entered at run time (10) Correctly handling opening, reading, and writing errors (25) Correctly printing one text file (30) Correctly printing multiple text file (25)

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

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

Students also viewed these Databases questions