new StreamWriter(String filePath)
using System;
using System.IO;
public class MyStreamWriterReader {
static void Main(string[] args) {
StreamWriter writer = new StreamWriter("reminders.txt");
writer.WriteLine("...");
writer.WriteLine("Don't forget these numbers:");
for (int i = 0; i < 10; i++)
writer.Write(i + " ");
writer.Write(writer.NewLine);
writer.Close();
StreamReader sr = new StreamReader("reminders.txt");
string input = null;
while ((input = sr.ReadLine()) != null) {
Console.WriteLine(input);
}
}
}
Related examples in the same category