Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // is undefined behaviour, works on gcc
- #include <stdio.h>
- #include <stdarg.h>
- int printf_count = 0;
- int printf(const char *fmt, ...)
- {
- printf_count++;
- va_list va;
- va_start(va, fmt);
- int ret = vprintf(fmt, va);
- va_end(va);
- return ret;
- }
- int main (void)
- {
- printf("TEST\n");
- printf("TEST\n");
- printf("TEST\n");
- printf("%d printf's were called", printf_count);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement