FileStream : Read or Write Data Streams  Posted by Mahesh Chand
Articles | C# Language December 13, 2000 FileStream class can be
used to read/write data to a file with the help of StreamReader
and StreamWriter classes. Reader Level:  Tools Used: Visual C#
.NET  The FileStream class is derived from Stream class. This
class can be used for reading from and writing to files such as
bytes, characters, strings, and other data-type values to a
file. Other class I have used in this sample is StreamWriter.
The StreamWriter class's Write and WriteLine members write to a
file.  In this sample code, I have used FileStream class to
create a text file and StreamWrite to write text to the text
file.  namespace mcFileStream using System; using System.IO;
public class mcLogFile public static void Main(String[] args) //
Create a text file C:\temp\mcb.txt FileStream fs = new
FileStream(@"c:\temp\mcb.txt" , FileMode.OpenOrCreate,
FileAccess.Write); StreamWriter m_streamWriter = new
StreamWriter(fs); // Write to the file using S