Description
INF211
ALGORITHMS AND PROGRAMMING
PROJECT-11
PROJECT-11: INPUT/OUTPUT
Projects that are not delivered on time are not accepted.
Upload the project to the Project 11 assignment section of the INF211 class.
The questions should be answered in this document. This document and the C code files for the questions should be uploaded to the assignment section. Please upload your .txt files after run the code.
The code filenames should be formatted as ID_N_P11_Q#.
Note:
Do not forget to write the meaning of what you do in the code as a comment.
You must also send the code files.
Filename format should be ID_FirstLetterofName_P#_Q#
Example: The code filename of Veli Zeki Doğan for question 1 should be
201029999_VZD_P11_Q1.C
Attention! Code filename that does not fit the format above will not be evaluated and takes zero grade.
Questions:
1-) Write a code to do following operations
a-print the contents of file
write a function to print the contents of a given file on screen. 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 function to count the Number of Characters in a File. Your function prototype should be in given format.
int findNumberofChar(FILE* fptr)
Please design your main.c file as follow
1- Open a text file to read in your directory.
2- Create an empty text file for writing and reading in same directory.
3- Check if both files are opened.
4- Print the contents of first file by calling PrintFileContent function.
5- Call copy_file function to copy contents of first file to empty file.
6- Call findNumberofChar function 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 the contents of second file by calling PrintFileContent function.
Your output should look like this:
After step 3:
After step 5:
After step 7:
After step 8:
ABOUT THE PROJECT
Process Prepared By
Reviews
There are no reviews yet.