由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - error in my function "write_log"
相关主题
fork() and execve() in UnixI/O implementation question
[转载] how to get process state in C/C++emacs问题求教----有关C程序格式
vi 一问.interview question
How to use sed to add newline character?awk question
about vi.问一个Unix Shell Script 的问题
paste command 里面的 -A problem about child process.
SOSSSS! Passwd file brokenUNIX文件系统一问
怎样打印出grep后的部分内容?[转载] Help, about clock().
相关话题的讨论汇总
话题: log话题: vl话题: write话题: format话题: tm
进入Unix版参与讨论
1 (共1页)
h*******c
发帖数: 5
1
I write a function "write_log" to log some message:
void write_log (FILE *fp_log, char *format, ...)
{
time_t tm;
va_list vl;

va_start(vl, format);
time(&tm);

printf("%s, pid:%d, ", cut_newline(ctime(&tm)),
(int)getpid());
printf(format, vl);
fprintf(fp_log, "%s, pid:%d, ",
cut_newline(ctime(&tm)), (int)getpid());
fprintf(fp_log, format, vl);
va_end(vl);
fflush(fp_log);
}
I call the function with : w
1 (共1页)
进入Unix版参与讨论
相关主题
[转载] Help, about clock().about vi.
偶要疯了!paste command 里面的 -
owner of fileSOSSSS! Passwd file broken
[转载] UNIX下的strtok怎样打印出grep后的部分内容?
fork() and execve() in UnixI/O implementation question
[转载] how to get process state in C/C++emacs问题求教----有关C程序格式
vi 一问.interview question
How to use sed to add newline character?awk question
相关话题的讨论汇总
话题: log话题: vl话题: write话题: format话题: tm