?? util.c
字號:
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#include "util.h"#define LOG_PATH "./log/"/*寫運行日志*/void WriteLog(char *s){ char filename[64]; FILE *fp = NULL; time_t clock; struct tm *timep = NULL; memset(filename,0x00,sizeof(filename)); if(s == NULL) return; clock = time(NULL); timep = (struct tm *)localtime(&clock); sprintf(filename,"%s%04d%02d%02d.log",LOG_PATH,timep->tm_year+1900,timep->tm_mon+1,timep->tm_mday); fp = fopen(filename,"a"); fprintf(fp,"[%04d/%02d/%02d %02d:%02d:%02d]%s\n", timep->tm_year+1900, timep->tm_mon+1,timep->tm_mday, timep->tm_hour,timep->tm_min, timep->tm_sec,s); fflush(fp); fclose(fp); return ;}/*去字符串空格*/void PackString(char *str){ char *pcS = str; char *pcD = str; while(*pcS) { if( *pcS != ' ') *pcD++ = *pcS; pcS++; } *pcD = 0; return;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -