Question: Using standard/IO Library, write reversecopy.c program that copies a file reversely. It takes 2 parameters, e.g.: >>./reversecopy.c a.txt b.txt This C program will copy the
Using standard/IO Library, write reversecopy.c program that copies a file reversely. It takes 2 parameters, e.g.:
>>./reversecopy.c a.txt b.txt
This C program will copy the content of a.txt into b.txt reversely. So if a.txt contains:
A B C D E F G
H I J K L M N
O P Q R S T U
V W X Y Z
b.txt will be containing the following after copying:
Z Y X W V
U T S R Q P O
N M L K J I H
G F E D C B A
You must use fseek() with proper parameters and ftell() functions to find the number of characters in the first input file (e.g. a.txt in the previous example). Then loop while the count is not zero decreasingly and copy the content from the end (backward) of a.txt to the current cursor (forward) of b.txt, then second last to second first, up to end of the loop. You need to setup the location of the cursor in a.txt using fseek() function with the proper parameters.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
