1 NX9+VS2012 2 3 #include <stdio.h> 4 #include <time.h> 5 6 char *wday[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; //指针数组-字符串 7 time_t timep; 8 struct tm *p; 9 time(&timep); 10 p = localtime(&timep); //取得当地具体时间 11 12 lw->Open(); 13 char msg[256]; 14 sprintf_s(msg, "%d %d %d %s %d:%d:%d ", (1900 + p->tm_year), (1 + p->tm_mon), p->tm_mday, wday[p->tm_wday], p->tm_hour, p->tm_min, p->tm_sec); 15 lw->WriteLine(msg);