Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 Write a C program which takes four command line arguments: two file names and two number of elements. Your program must check if

image text in transcribed

Question 1 Write a C program which takes four command line arguments: two file names and two number of elements. Your program must check if correct number of arguments are supplied and terminate if not. Your main process must create three processes: The first and second processes must open / create files by the given names and fill them with the given number of random integers (one integer per line) and terminate. The third process must execute "sort" command with necessary arguments so that it numerically sorts both files and display the combined result on screen. Before creating the third child process, main process must wait for the other two child processes to end. Sample Run $ ./question1 randfile1.txt randfile2.txt 40 70 [PARENT] Creating first process... [PARENT] Creating second process... [CHILD1] Writing 40 random integers to randfile1.txt... (78 32 56...) [CHILD2] Writing 70 random integers to randfile2.txt... (46 In 88 45...) [PARENT] Creating third process... [CHILD3] Sorting both files: 32 45 46 in 56 In 78 88 ... [PARENT] Done

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

Database Publishing With Filemaker Pro On The Web

Authors: Maria Langer

1st Edition

0201696657, 978-0201696653

More Books

Students also viewed these Databases questions