CS 200 - Lab 23

File I/O

In this lab you will write a program to count the number of upper case letters and the number of lower case letters in an input file.  Once you have counted the upper and lower case characters, your program should write a report to a file indicating the count of each kind of character.  The report should be saved in the file


The input file your program should read is this one:


Save it in the root folder of your H: drive.

When your program runs, it should print output (to stdout) looking something like this:

Successfully opened input file
Successfully read contents of input file
Successfully wrote report to output file

The contents of the report file should look something like this:

The input file contained:
523525 lower case letters
12882 upper case letters

Open the report file in a text editor (e.g., Notepad) to make sure that its contents are correct.

Getting Started

If you have a solution open in Visual Studio, close it (File->Close Solution).

Download lab23.zip.  Import it into Visual Studio (File->Import...).

Add your code to the source file called LetterCount.c.


Here is how you can open the input file in your program:

FILE *in;


in = fopen("H:/pandp.txt", "r");

Here is how you can open the report  output file in your program:

FILE *out;


out = fopen("H:/lab23report.txt", "w");