Stream stream = File.Open(NewFilename, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite); StreamWriter writer = new StreamWriter(stream, Encoding.Default);