Chapter 11. Filesystem I/O
This chapter deals with the
filesystem in four distinct ways. The first set of recipes looks at
typical file interactions like creation, reading and writing,
deletion, attributes, encoding methods for character data, and how to
select the correct way (based on usage) to access files via streams.
The second set looks at directory- or folder-based programming tasks
like file creation as well as renaming, deleting, and determining
attributes. The third set deals with the parsing of paths and the use
of temporary files and paths, and the fourth set deals with more
advanced topics in filesystem I/O, like asynchronous reads and
writes, monitoring for certain filesystem actions, version
information in files, and using P/Invoke to perform file I/O.
The file interactions section comes first since it sets the stage for
many of the recipes in the temporary file and advanced sections. This
is foundational knowledge that will help you understand the other
file I/O recipes and how to modify them for your purposes. The
various file and directory I/O techniques are used throughout the
more advanced examples to help show a couple of different ways to
approach the problems you will encounter working with filesystem I/O.
Unless otherwise specified, you need the following
using statements in any program that uses snippets
or methods from this chapter:
using System;
using System.IO;
|