syslog()的基本用法

mac2022-06-30  26

参考自《Linux程序设计》第二版 P137

#include <stdio.h> #include <errno.h> #include <stdlib.h> #include <syslog.h> int main(void){ FILE *pfile; pfile = fopen("/home/kkk", "r"); if(!pfile){ syslog(LOG_ERR, "Error: %m"); } exit(0); } $tail -1 /var/log/messages

Feb 18 23:01:38 lujinhong a.out: Error: No such file or directory

转载于:https://www.cnblogs.com/jinhong-lu/archive/2013/02/18/4559553.html

最新回复(0)