Advanced File Input and Output
Summary: This lab reinforces formatted input using files and introduces and binary file I/O.
Formatted I/O
-
Download and compile,
state-year.c. (Note: Do not download the data file yet.)- Run the program. Try to generate at least three different kinds of error messages.
-
Download the accompanying data file
state-income.txt. Run the program for a few valid years and ensure you understand how it works.
-
Using
state-year.cas a template, write a programstate-year-decrease.cwhich prints for each state, each pair of years for which the median income decreased. For example,Be sure you cite the origins of your derivative work and clarify which portions are original to your new program and authored by you../state-year-decrease
United States Alabama 1992-1993 Alaska 1996-1997 1991-1992 1990-1991 1985-1986 1984-1985 1981-1982 Arizona 1992-1993 1982-1983 Arkansas 1995-1996 1992-1993 California 1992-1993 Colorado Connecticut Delaware 1994-1995 1992-1993 ...
Binary I/O
Image I/O
-
Write a program that instructs the robot to take a picture and then
writes the
structwith the picture data to a file usingfwrite. -
Write a program that uses
freadto read the binary data for a picturestructand the usesrDisplayPicturefrom theMyroCheader to display the picture.
General Data I/O
-
Write a program called
intwrite.cthat reads in a series of integers from standard input using any method you prefer. The program should then imediately write these integers to a binary file of your choosing usingfwrite. -
Write a companion program called
intread.cthat reads in integers from the binary file and writes them each on a new line tostdout.
