.NET Framework: Reading and Writing with a Text File
This sample shows some how to use the StreamReader and StreamWriter classes
to read and write text files.
Featured Highlights:
This tutorial demonstrates how to read from and write to text files. In
particular, it discusses:
-
Creating a new text file, that is ready to accept text.
-
Appending to a currently existing text file.
-
Reading an entire file in one method call.
-
Reading a file line by line.
-
Reading a file character by character..
Requirements:
Microsoft Visual Studio .NET Professional (or greater).
Windows 2000 or Windows XP.Running the Sample:
Simply press F5.
See Also:
System.IO.StreamReader,
System.IO.StreamWriter,
System.IO Namespace