public static int CharCount (StreamReader strIn)
{
int c;
int fileSize = 0;
while ((c = strIn.Read()) != -1)
++fileSize;
return fileSize;
}
{
int c;
int fileSize = 0;
while ((c = strIn.Read()) != -1)
++fileSize;
return fileSize;
}
public static void Main (string[] args)
{
StreamReader strIn = new StreamReader(“d:\\test.txt”);
Console.WriteLine("char count is " + CharCount( strIn));
strIn.Close();
}
No comments:
Post a Comment