推荐使用这个:
static void trace(const char *format, ...){
FILE *fp = NULL;
va_list args;
fp = fopen("/var/tmp/whj.txt", "a+");
if (fp){
va_start(args, format);
vfprintf(fp, format, args);
fflush(fp);
va_end(args);
fclose(fp);
}
}
trace("tasktype=%d&hostname=%s&description=%s",tasktype,hostname,description);
void DebugOut(char *str){
FILE *fp = fopen("/var/tmp/debug.txt", "a+");
if (fp){
fprintf(fp, "%s\n", str);
fclose(fp);
}
}
static void trace(const char *format, ...){
FILE *fp = NULL;
va_list args;
fp = fopen("/var/tmp/whj.txt", "a+");
if (fp){
va_start(args, format);
vfprintf(fp, format, args);
fflush(fp);
va_end(args);
fclose(fp);
}
}
trace("tasktype=%d&hostname=%s&description=%s",tasktype,hostname,description);
void DebugOut(char *str){
FILE *fp = fopen("/var/tmp/debug.txt", "a+");
if (fp){
fprintf(fp, "%s\n", str);
fclose(fp);
}
}