Question 1:
Using only standard I/O functions(like fopen(), fseek(), ftell(), fgets(), etc.), write a C program to reverse the order of the lines in a text file. That is the first line becomes last, the second line becomes the one before the last one and so on.
Note: your program should have two arguments, the input file name and the
output file name.
Call model: reverseFile
Example:
Input file:
Hello
I am happy to see you
Output file:
I am happy to see you
Hello
Question 2:
Discover what happens within a parent process when a child closes a file descriptor inherited across a fork. In other words, does the file remain open in the parent, or is it closed there? write a program to investigate the answer.
Note that you not only need to give the answer to the question asked, but also you need to write a program to demonstrate/support how you obtain your answer (for example, write a program such that in the parent process, you open a file, sleep , and then in the child process, you close the file, then back in the parent process, check if the file is still accessible in the parent process).