O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Binary Input and Output with the FileStream Class

FileStream is a commonly used and versatile binary stream class that can be used to read and write individual bytes and blocks of bytes. Because characters are merely encoded bytes, the FileStream class can also be used to stream characters. However, it does not contain the same convenient methods targeted at character streams as do the StreamReader and StreamWriter classes.

The FileStream class can be used to create new files as well as open existing files.

Table 22.5 lists a few of FileStream's class members.

Table 22.5. A Few Selected FileStream Class Members
FileStream class member Description
Close Closes the stream and releases any associated resources
ReadByte Reads one byte from the stream ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required