CS 302 - Programming Assignment 7

This assignment makes use of two files contained in this zip file.

For this assignment you are to write a program that accesses a floppy disk at a fairly low level. This assignment is the first of two assignments that will be about floppy disks. The second assignment will look at the "file allocation table" (i.e., FAT) that is on the floppy disk.

You are to write implementations for the following three functions, which are described in comments in the file floppy.h which is contained in the above zip file.

HANDLE physicalDisk(char driveLetter);
void sectorRead(HANDLE theDisk, unsigned int logicalSectorNumber, unsigned char* buffer);
void sectorDump(HANDLE theDisk, unsigned int logicalSectorNumber);
Your definitions of the three functions must work with the driver program floppy.c which is also in the above zip file (you do not need to make any changes in the file floppy.c). Make sure that you error check all of the Win32 function calls that you make. For example, your program should produce meaningful error messages if there is no floppy disk in the drive, or if the floppy disk is not formatted.

When you have this program done, experiment with it. Take a blank floppy disk and look at a bunch of its sectors. Are they empty? Format the floppy and look at the sectors again. Add a small text file to the newly formatted disk. Find the sectors that the file's data are written to (the data sectors will be after sector 10). Now delete the file. Is the data still there in the sectors? If you have access to a "boot floppy", look at its sector 0 and compare it to sector 0 of a non boot disk.

Turn in a zip file containing your version of the floppy.h file and also the floppy.c file.

This assignment is due Monday, April 18.

Here are links to three of the Win32 API functions that you will need to use in this assignment.


Return to the main homework page.
Return to the CS 302 home page.


compliments and criticisms