using System;
using System.IO;
public class MainClass {
public static void Main() {
FileStream fs2 = File.Create("Bar.txt");
StreamWriter w2 = new StreamWriter(fs2);
w2.Write("Goodbye Mars");
w2.Close();
fs2 = File.Open("Bar.txt", FileMode.Open, FileAccess.Read, FileShare.None);
StreamReader r2 = new StreamReader(fs2);
String t;
while ((t = r2.ReadLine()) != null) {
Console.WriteLine(t);
}
w2.Close();
fs2.Close();
}
}
|