Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions