Question: Assignment 2: Linux System Calls - Process Management Write a C++ program that forks two child processes: 1- Child 1 process will look for all

 Assignment 2: Linux System Calls - Process Management Write a C++program that forks two child processes: 1- Child 1 process will look

Assignment 2: Linux System Calls - Process Management Write a C++ program that forks two child processes: 1- Child 1 process will look for all the C++ programs stored in your home directory and store the searching results in a text file called (CPP_files.txt). (ONE statement ONLY to accomplish this task) Hint: you need to use (find *.cpp) command, the result of the find command should be stored in the CPP_files.txt file. 2- Child 2 process should reads the content of (CPP_files.txt) file and it should find number of lines in each .cpp file and store the results in a file called Output.txt Hint: you need to use the (wc-1) command. Child 2 MUST use the execve system call to accomplish its task. 3- At the end, the parent Process should delete the CPP_files.txt file. CPP_files.txt prog1.cpp test.cpp prog2.cpp Assignment_1.cpp Output.txt 15 progi.cpp 48 test.cpp 12 prog2.cpp 60 Assignment_1.cpp A Sample program that reads from file in C++: #include #include // include the fstream (file stream library) using namespace std; int main() { // declaring an input file called infile ifstream infile; // opening the input file (file we will read from) that called CPP_files.txt infile.open("CPP_files.txt"); string str; // loop to read the content of the file line by line till the end of the file while(infile>>str) { // display the line we read from the file on the screen (terminal) cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!