Week of April 10, 2016
Topics for this week: Streams and File I/O
||Read chapter 13 in your course packet
||Review the slides File I/O
lab #25. It is due by 11:59pm on Tuesday.
lab #26. It is due by 11:59pm on Thursday.
project #11. It is due by 11:59pm on Sunday.
||Study the code example
here that illustrates some important concepts in file I/O.
It is expected that you will meet the objectives outlined here by the end of the week.
You might want to test yourself to see how well you fare. You can be guaranteed that you
will be tested on these concepts on your next exam. By the end of this unit, you should
be able to:
- describe the concept of a stream.
- correctly declare the stream objects that are used for file input and file output.
- correctly append to a file or write over an existing file.
- check to see if the end of the file has been reached when reading from the file.
- explain the difference between character and binary I/O.
- correctly format data when writing to a text file.
- write a program that correctly reads and writes text data.
All reading should be done before you come to class.
- Chapter 14 in the course packet discusses the C# stream classes that are
used for file I/O.
- Streams and File I/O - we will go over these
slides in class. One of the major topics in this set of slides is how we handle
error situations when reading and writing files.
You should be sure that you understand the following important ideas about streams
and file I/O:
- A stream is a sequential set of data. We read from Input Streams and we write
to Output Streams.
- To read from a file, you need an object of the StreamReader class.
- To write to a file, you need an object of the StreamWriter class.
- In C#, data can be stored in a file either as text data (ordinary unicode characters),
or as binary data. Binary data is stored on disk exactly as it is stored in the computer's memory.
This week you should complete labs 25 and 26. These lab will give you some practice dealing
with file I/O issues.
Be sure that you include the declaration that you did not copy any code in all
of your source code files. If this statement does not appear in your program, it
will not be graded.