This code works when I am debugging in Visual Studio:
private void writeToDatFile(string[] lines)
{
string filePath = @"C:\Randomization.dat";
string fileName = txt_FileName.Text;
FileInfo fi = new FileInfo(filePath);
if (File.Exists(filePath))
{ File.Delete(filePath); }
/*
* Do it this way so UNIX can read it in as line feeds without
* having to screw around with Window's carriage return
*/
using (FileStream fs = fi.OpenWrite())
{
foreach (string str in lines)
{
Byte[] data = new UTF8Encoding(true).GetBytes(str);
fs.Write(data, 0, data.Length);
}
}
// Send the .DAT file to the user with this web browser junk
System.We ...
Go to the complete details ...