Read a single character : Stream « File Stream « C# / C Sharp
- C# / C Sharp
- File Stream
- Stream
Read a single character
using System;
using System.IO;
class StrmRdrRead
{
public static void Main()
{
FileInfo MyFile=new FileInfo(@"c:\csc.txt");
//Instantiate a StreamReader to read from the text file.
StreamReader sr=MyFile.OpenText();
int FirstChar=sr.Read();
Console.WriteLine(FirstChar);
sr.Close();
}
}
Related examples in the same category