Closed Slion closed 1 week ago
You should call vprintf
in your variadic function, not printf
(and just pass args
rather than &args
.
Otherwise you've told printf to display four integers but only passed one argument (the address of a va_list
variable).
See https://en.cppreference.com/w/c/io/vfprintf.
Thanks, that did it! My C is a little bit rusty 😁
int log_debug(const char *fmt,...) {
int n;
va_list args;
va_start (args, fmt);
n = vprintf(fmt, args);
va_end(args);
return n;
}
Pico W SDK 1.5.1
Can't get simple variadic function to work for some reason.
printf
works fine but my own variadic function breaks arguments formatting somehow.That's the output I get: