Question: Program C Write a program for each of the following questions. If your main() function does more than one task, define the necessary functions to

 Program C Write a program for each of the following questions.

Program C

Write a program for each of the following questions. If your main() function does more than one task, define the necessary functions to take care of those tasks. Files referred to in these exercises are text files. You can assume that file names do not contain whitespaces. 1. Write a function int copy(char const *infile, char const *outfile). This function copies the content of a file whose name is infile to another file whose name is outfile. The function returns 1 if the copy attempt is successful and 0 if it fails. 2. Write a function that takes an input file name and an output file name as parameters then copy the content of the input file to the out file with a line number, starting from 1, at the beginning of each line. The function returns 1 if the copy attempt is successful and O if it fails. 3. Write a function that takes a file name as parameter then returns the number of lines (a line is a sequence of characters ending by a newline), and the number of words (a word is a sequence of characters ending by a whitespace) in that file

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!