how to load and save files using FileStream in C#

Prabhukiran345
Posted by Prabhukiran345 under C# category on | Points: 40 | Views : 718
This example shows how to open files for reading or writing, how to load and save files using FileStream in C#. To open file create instance of FileStream class with FileMode and FileAccess enumerations as parameters.
using System.IO;

FileStream fileStream = new FileStream(@"c:\file.txt", FileMode.Open);
try
{
// read from file or write to file
}
finally
{
fileStream.Close();
}

Comments or Responses

Login to post response