Chapter 3: Fishing the FileStream
In This Chapter
Reading and writing data files
Using the Stream
classes
Using the using
statement
Dealing with input/output errors
I once caught two trout on a single hook, in a lovely mountain stream in my native Colorado — quite a thrill for an 11-year-old. Fishing the “file stream” with C# isn’t quite so thrilling, but it’s one of those indispensable programming skills.
File access refers to the storage and retrieval of data on the disk. I cover basic text-file input/output in this chapter. Reading and writing data from databases is covered in Chapter 2 of this minibook, and reading and writing information to the Internet is covered in Chapter 4.
Going Where the Fish Are: The FileStream
The console application programs in this book mostly take their input from, and send their output to, the console. Programs outside this chapter have better — or at least different — things to bore you with than file manipulation. I don’t want to confuse their message with the extra baggage of involved input/output (I/O). However, console applications that don’t ...