Question: Objectives To practice creating, managing, and terminating processes using system calls in C . To manipulate files and directories with system calls. To demonstrate error

Objectives
To practice creating, managing, and terminating processes using system calls in C.
To manipulate files and directories with system calls.
To demonstrate error handling in system-level programming.
Description
In this homework, you will implement a program that performs file manipulation and
manages multiple child processes to perform tasks on files in a given directory. The program
will:
1. Accept a directory as a command-line argument.
2. For each file in the directory, create a child process that prints the file name, its size,
and the number of words in the file.
3. Ensure the parent process waits for all child processes to complete before exiting.
4. Implement basic error handling: check for invalid directories, failed process creation,
and inaccessible files.
Detailed Requirements:
Command-line Arguments:
o The program should accept one command-line argument, which is the
directory name.
o If no argument is provided, the program should print an error message and
exit.
o If the directory is invalid or doesn't exist, print an error message and exit.

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 Programming Questions!