المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Wrapper function for sprintf, strcpy, strcat?



C++ Programming
06-20-2009, 10:10 PM
Hello

I am working on VS2003 and using the above mentioned functions, but the compiler gives me warning saying those functions are #pragma depreciated.

I know VS2008 has functions like sprintf_s, but unfortunately i will not be able to upgrade to 2008.

So now i want to use a wrapper function around sprintf, which will do the additional work that sprintf_s will do and there by making sure that i call sprintf only once.

This new wrapper function should be able to check for buffer over run and then i will call sprintf inside this function.

What it will do is, it will make sure that, i only need to call sprintf once and that will bring down compiler warning to just one.

Is anyone aware of such a wrapper function? Or can anyone help write a wrapper?

Thanks in advance.