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

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -