Reads given file character by character and count them and lines in C

Writing a program that reads a given file character by character, and prints them on the screen, followed by the number of lines and characters. The name of the file will be read from the command line, as follows:
ProgramName filename
You are supposed to use the skeleton file ReadFile.c
After adding the missing codes, execute your program with the text file failure_to_communicate.txt given as the command line argument. Does your program print all the contents of the file? Are the values displayed for number of lines and characters correct? If not, correct the code appropriately so that your program prints all of the file contents, and the values displayed for number of lines and characters are correct.
Test: You can test your code by checking if the contents of the failure_to_communicate.txt are properly displayed attached bellow, followed by the number of lines and characters, which are 9 and 594, respectively.

failure_to_communicate.txt

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *