Answers
May 13, 2008 - 06:04 AM
Firstly you cannot have certain characters (like / and :) in filenames so you need to rethink your naming strategy
Simple way of creaing a file
StreamWriter streamWriter;
streamWriter = File.CreateText("c:\\Quomon.txt");
streamWriter.Close();
The above creates a text file called Quomon.txt in the C drive. You need to use System.IO when using StreamWriter.
Now if you want to name the file to the current date/time, you need to first get it then convert to a string
eg
DateTime currentDateTime = DateTime.Now;
String dateStr = currentDateTime.ToString("yyyy-MM-dd HH_mm_ss");
Now you can use dateStr as part of your filenaming eg - create a file with current datetime and prefixed with Quomon
StreamWriter streamWriter;
streamWriter = File.CreateText("c:\\Quomon " + dateStr + ".txt");
streamWriter.Close();
Finally, if I sent you an email, it defeats the purpose of this forum where no one can see the responses
Simple way of creaing a file
StreamWriter streamWriter;
streamWriter = File.CreateText("c:\\Quomon.txt");
streamWriter.Close();
The above creates a text file called Quomon.txt in the C drive. You need to use System.IO when using StreamWriter.
Now if you want to name the file to the current date/time, you need to first get it then convert to a string
eg
DateTime currentDateTime = DateTime.Now;
String dateStr = currentDateTime.ToString("yyyy-MM-dd HH_mm_ss");
Now you can use dateStr as part of your filenaming eg - create a file with current datetime and prefixed with Quomon
StreamWriter streamWriter;
streamWriter = File.CreateText("c:\\Quomon " + dateStr + ".txt");
streamWriter.Close();
Finally, if I sent you an email, it defeats the purpose of this forum where no one can see the responses
Mar 04, 2009 - 06:08 AM
The question looks to be abandoned by the user who asked it. If no action is taken within 2 days, a Quomon Moderator will consider closing the question and distributing the points.
The Quomon Team
The Quomon Team
Add New Comment