Skip to content

Instantly share code, notes, and snippets.

@glukianets
glukianets / prontf.c
Last active June 14, 2019 16:44
A simple c function proxying standard printf slightly modifying contents on the way.
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
int prontf(const char *fmt, ...) {
va_list varargs;
va_start(varargs, fmt);
int bufsize = vsnprintf(NULL, 0, fmt, varargs) + 1;
va_end(varargs);