Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

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

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_2

Step: 3

blur-text-image_3

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 Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

1. What is the meaning and definition of banks ?

Answered: 1 week ago

Question

2. What is the meaning and definition of Banking?

Answered: 1 week ago

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago