using System;
using System.IO;
public class IOExample
{
static void Main() {
FileStream fs;
StreamReader srIn;
try {
fs = new FileStream("practice.txt", FileMode.Open );
srIn = new StreamReader(fs);
string line = srIn.ReadLine();
Console.WriteLine("line = "+line);
srIn.Close();
} catch (IOException ioe) {
Console.WriteLine("IOException occurred: "+ioe.Message);
}
}
}
|