YCP Logo Lab 24: File I/O

Due: Monday, November 3rd by 11:59 PM

Getting Started

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

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

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

Your Task

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

H:/lab24report.txt

The input file your program should read is this one:

pandp.txt

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.

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:/lab24report.txt", "w");

Submitting

When you are done, choose Tools->Submit to submit your completed lab to the server. You will need to enter your Marmoset username and password.

If the Tools->Submit option does not work, create a zip file containing the files in your project, and upload it to the submission server as lab24. The server URL is

https://camel.ycp.edu:8443/