using System.Text; using System.IO; string filename = "c:\\path\\to\\file.txt"; //'using' structure allows for proper disposal of stream. using (StreamWriter writer = new StreamWriter(filename")) { writer.WriteLine("Text to Write\\n"); }