Saving a Text File |
| Created Date: 4/23/2008 |
| Last Modified Date: 4/23/2008 |
| Along with open file not having an intrinsic way of performing the task, the intrinsic save text file method is also not present in the .Net framework. This is a sample piece of code that performs that task.
C# using System.IO; protected internal static void SaveFile(String FileName, String FileContents) { if (File.Exists(FileName)) { File.Delete(FileName); } StreamWriter SW; SW = File.CreateText(FileName); SW.Write(FileContents); SW.Close(); } |
| :: Coding Basics :: |
