void LogOutMsg(char* fn,char *fmt,...)
{
time_t rawtime;
struct tm *timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
char curTime[256] = {0};
strftime(curTime,100,"%Y-%m-%d %H:%M:%S ",timeinfo);
char sprintf_buf[256];
char cOut[512];
va_list args;
int n=1;
va_start(args,fmt);
n = vsprintf(sprintf_buf,fmt,args);
//printf("%s>> %s\n",curTime,sprintf_buf);
sprintf(cOut,"%s>>%s\n",curTime,sprintf_buf);
va_end(args);
FILE* fp;
fp = fopen(fn,"a");
if(fp == NULL) return;
fseek(fp,0L,SEEK_END);
unsigned long fs = ftell(fp);
fseek(fp,fs,SEEK_SET);
fputs(cOut,fp);
fclose(fp);
}
{
time_t rawtime;
struct tm *timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
char curTime[256] = {0};
strftime(curTime,100,"%Y-%m-%d %H:%M:%S ",timeinfo);
char sprintf_buf[256];
char cOut[512];
va_list args;
int n=1;
va_start(args,fmt);
n = vsprintf(sprintf_buf,fmt,args);
//printf("%s>> %s\n",curTime,sprintf_buf);
sprintf(cOut,"%s>>%s\n",curTime,sprintf_buf);
va_end(args);
FILE* fp;
fp = fopen(fn,"a");
if(fp == NULL) return;
fseek(fp,0L,SEEK_END);
unsigned long fs = ftell(fp);
fseek(fp,fs,SEEK_SET);
fputs(cOut,fp);
fclose(fp);
}