Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1-) Write a code to do following operations a-print the contents of file write a function to print the contents of a given fileonscreen. Your

1-) Write a code to do following operations

a-print the contents of file

write a function to print the contents of a given fileonscreen. Your function prototype should be in given format.

void PrintFileContent(FILE* fptr)

b-copy contents of one file to another file

write a function to copy contents of one file to another file. Convert all characters into uppercase while copying the content. You are allowed to use toupper() function in ctype library. Your function prototype should be in given format.

void copy_file(FILE* fptr1,FILE* fptr2)

c-count the Number of Characters in a File

write a functionto count the Number of Characters in a File.Your function prototype should be in given format.

int findNumberofChar(FILE* fptr)

Please designyourmain.c file as follow

1-Open a text file to read in your directory.

2-Create anempty textfile for writingand reading in same directory.

3-Check if both files are opened.

4-Print thecontents of first file by callingPrintFileContentfunction.

5-Call copy_filefunction to copy contents of first file to empty file.

6-Call findNumberofCharfunction to count the Number of Characters in the second file.

7-Write the number of characters in the second file into the same file.

8-Print thecontents of secondfile by callingPrintFileContentfunction.

NOTE:I would be glad if you add the output images.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions