Question: Write the program fileReplace that takes three command-line arguments: a source file name, a target word, and a replacement word. Modify the specified source file

Write the program fileReplace that takes three command-line arguments: a source file name, a target word, and a replacement word.
Modify the specified source file (do not create a new file) so that, within the text, the target word is replaced with the replacement word. The target word and replacement word must be the same length.
Attached is a example of the work we are doing.
 Write the program fileReplace that takes three command-line arguments: a source

#include #include #include int main(int argc, char argv[]) if (argc "); return -1; int inFile = open ( argv [1], O RDONLY); if (inFile0) write (outFile, buffer, bytesRead); lseek (outFile, -10, SEEK END) write (outFile, "glasses", 10); lseek (outFile, 0, SEEK SET) write (outFile, "Her", 3); close (inFile); close (outFile); return 0

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