PrintLikeLogFunction

#include <stdarg.h>
FILE* pLogFile = NULL;
#define LOG_FILE "log.txt"
void log(char *fmt, ...)
{
if(!pLogFile)
pLogFile = fopen(LOG_FILE, "w");
va_list ap ;
va_start(ap, fmt) ;
vfprintf(pLogFile, fmt, ap) ;
fprintf(pLogFile, "\n");
fflush(pLogFile);
va_end(ap);
}