Question: Using system calls, fork(), wait(), open(), close(), read() and write(), write a C program to code a sentence by inversing it, character-wise. In particular, your

Using system calls, fork(), wait(), open(), close(), read() and write(), 

write a C program to code a sentence by inversing it, character-wise. In particular, your program should 

• Prompts the message "This program codes a sentence", 

• Gets in an infinite loop then 

1. Promptsthemessage"Enterasentence,e.g.,Goodday,mynameisBigFoot", 

2. Reads a whole line from the keyboard, 

3. Uses system call fork() to fork then, 

– the parent writes the message "I just created a child to perform a task, waiting for my child... and, calls wait() to wait for its child process. 

– the child process calls function childFunction()

4. The
– writes the message "I am a child process working for my parent"

child, through childFunction(char *line),
– codes the text stored in line (E.g, the above sentence becomes "tooFgiB si

eman ym , yad doog"),

–  in case of an empty line, the child calls exit(55),


Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

include include include include include include void childFunctionchar line in... View full answer

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!