c++ - passing variable parameter list to syslog -
i try pass variable parameter list function. there similary question: how pass variable number of arguments printf/sprintf me doesn't work. , don't know why. function:
void printsyslognotice(const char *fmt, ...) { va_list ap; va_start(ap, fmt); #ifdef __xeno__ rt_syslog(log_notice, fmt, ap); #else syslog(log_notice, fmt, ap); #endif va_end(ap); } when call with:
printsyslognotice("%s %i", "hello world", 5); i output: #010 -939524064
needless say, output: hello world 5
does has idea?
you should use vsyslog, not syslog. syslog receives variable parameters pack, not va_list. if want call syslog should pass arguments is, not va_list.
Comments
Post a Comment