Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 C Practice (50 pts) Write a C program in Linux that will read N ( 1 ) input file(s), identify unique common words that

image text in transcribed

2 C Practice (50 pts) Write a C program in Linux that will read N ( 1 ) input file(s), identify unique common words that appear in all input file(s), and write them into an output file in ascending sorted order based on the word field using the strcmp () function. You can only use the linked list data structure in this project but you are free to use singly or doubly linked lists. Each line of the output file will include a unique word. The output should not contain any spaces, TABs, or empty lines. So, after you write the last line of information ending with a newline character (similar to the other lines), you should close the file, and this should be the end of your program. It is very important that you produce the output in this rigid format since we will use this format in our automated black-box tests. Make sure you pass the provided black-box test before submission. Words in input files are separated by whitespace characters, which can either be a SPACE >, a , or a NEWLINE > character. 2.1 Development It is mandatory for this assignment that you use the linked list data structure and dynamic memory allocation. You can only use standard C library functions with the exception of qsort. So, qsort is not allowed to be used! Also, you cannot assume a maximum number of characters for the words, so the memory for them should be created dynamically as well. This project will allow you to practice with malloc, pointers, and C structs. The name of your executable file has to be common and a sample invocation of your program is as follows: ./common 3 in1.txt in2.txt in3.txt out.txt Here, 3 indicates that there will be three input files, in 1 .txt is name of the the first input text file, in2 . txt is the name of the second input text file, in 3.txt is the name of the third input text file, and out. . xt is the name of the output text file which you will store your final output. Note that input and output file names do not have to follow any naming convention, different names can be passed to the program as command-line arguments. It is very important that you follow the specifications so that you do not lose any points. Example 1 Assume the content of in 1 . txt is as follows: the content of in2. txt is as follows: Project \#1 CSE 420: Design of Operating Systems Spring 2023 Michael likes someone They went out on a date to eat dinner last Saturday And I think she likes him, too... and the content of in3. txt is as follows: Assuming the following invocation: ./common 3 in1.txt in2.txt in3.txt out.txt The output file out. txt should be as follows: Please note that punctuation characters are not be stripped off the words. Therefore, "too!", "too...", and "too" are considered to be different words. You will develop your program in a Unix environment using the C programming language. You can develop your program using a text editor (emacs, vi, gedit etc.) or an Integrated Development Environment available in Linux. gcc will be used as the compiler. You will be provided a Makefile and your program should compile without any errors/warnings using this Makefile. Black-box testing will be applied and your program's output will be compared to the correct output. A simple black-box testing script will be provided to you for your own test; make sure that your program produces the success message in the provided test. A more complicated test (possibly more then one test) might be applied to grade your program. Submissions not following the specified rules here will be penalized

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

Students also viewed these Databases questions

Question

Verify the statement made in the remark following Example 10.2.

Answered: 1 week ago

Question

What are the APPROACHES TO HRM?

Answered: 1 week ago