CSharp examples for File IO:Text File
Behaves like the Linux cat utility
using System;//from w w w .j a v a 2 s .com using System.IO; public class cat { public static void Main(string[] args) { String line; foreach(string filename in args) { StreamReader file; if (File.Exists(filename)) { file = new StreamReader(@filename); while((line = file.ReadLine()) != null) { Console.WriteLine(line); } file.Close(); } else { Console.WriteLine("Oops, file {0} not found!", filename); } Console.WriteLine(); } } }