warning C4996: 'fopen' was declared deprecated  
Author Message
bxchan





PostPosted: Visual C++ Language, warning C4996: 'fopen' was declared deprecated Top

Hi,

after compile some "old code" in VC++ 2005 it was came out with error. May i know how to solve it

warning C4996: 'fopen' was declared deprecated

warning C4996: 'strcpy' was declared deprecated

warning C4996: 'sprintf' was declared deprecated




Visual C++5  
 
 
Alex Farber





PostPosted: Visual C++ Language, warning C4996: 'fopen' was declared deprecated Top

Use fopen_s instead of fopen, strcpy_s instead of strcpy, and sprintf_s instead of sprintf.

If you want to remove this warning without changing the code, use _CRT_SECURE_NO_DEPRECATE precompiler constant.


 
 
C.Nic





PostPosted: Visual C++ Language, warning C4996: 'fopen' was declared deprecated Top

You might want also to define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES to 1. This will automatically call the secure variants of the CRT functions.

Read more here: http://msdn2.microsoft.com/en-us/library/ms175759(vs.80).aspx