Dian Adriyanto

Dian Adriyanto

  • NA
  • 3
  • 864

log file for Time clock update

Feb 15 2015 11:16 PM
Dear team
 
i've got problem yet and i just put this code but can't record for the log file, i ask for advice which one the wrong or still poor that source
 
public static void CheckTime(object state)
{
Console.WriteLine(DateTime.Now);
}
static void Main(string[] args)
{
TextWriter txt = new StreamWriter("c:\\log\\di.txt",true);
TimerCallback ti = new TimerCallback(CheckTime);


Timer t = new Timer(ti, null, 1000, 500);


int i = Console.Read();


t.Dispose();
t = null;
txt.WriteLine(i);
txt.Close(); 
 
thanks
 Dian Adriyanto

Answers (2)