boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - error in my function "write_log"
相关主题
fork() and execve() in Unix
[转载] how to get process state in C/C++
vi 一问.
How to use sed to add newline character?
about vi.
paste command 里面的 -
SOSSSS! Passwd file broken
怎样打印出grep后的部分内容?
I/O implementation question
emacs问题求教----有关C程序格式
相关话题的讨论汇总
话题: 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版参与讨论
相关主题
emacs问题求教----有关C程序格式
interview question
awk question
问一个Unix Shell Script 的问题
A problem about child process.
UNIX文件系统一问
[转载] Help, about clock().
偶要疯了!
owner of file
[转载] UNIX下的strtok
相关话题的讨论汇总
话题: log话题: vl话题: write话题: format话题: tm