Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Reverse Order of Lines in a Text File using Standard I/O Functions in C

Question 1

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).

support
close