string _file = @"c:\" + System.DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt";
System.IO.FileStream fileStream = new System.IO.FileStream(_file, System.IO.FileMode.Create);
fileStream.Close();
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(_file))
{
sw.Write(str);
}