Chapter 7. File Input / Output

Table of Contents

1. Exception Handling
2. Streams
3. Files

COMPUTER PROGRAMS ARE ONLY USEFUL if they interact with the rest of the world in some way. This interaction is referred to as input/output, or I/O. Up until now, the only type of interaction that has been covered in this textbook is interaction with the user, through a command-line interface. But the user is only one possible source of information and only one possible destination for information. In this chapter, we'll look at others, including files and network connections. In C#, input/output involving files and networks is based on streams, which are objects that support the same sort of I/O commands that you have already used to communicate with the user in a command-line interface.

Working with files requires that you know how to write exception handlers. So this chapter begins with that topic, and then we'll get to file I/O.