c++ - How to call my_function before every time sprintf is called? -


sprintf api provided platform. want filter format when used. idea is:

#include <stdio.h>  int my_sprintf(...) {     my_filter_function(...);     return ::sprintf(...);   }  #define sprintf my_sprintf 

then put these code in pch.

but still worrying can't cover usages, 1 in prebuilt library , not every project has pch. have other idea?

thanks. it's on windows.

you can't "overwrite" built-in function. furthermore, using macro replace name results in program having undefined behaviour.

so, don't try change behaviour of standard library. really, way madness lies.

just call my_sprintf own code , let platform did.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -