Tag Archives: C

C language string processing error warning, c4996, sprintf, predicted, c4996, strcpy, c4996, strcat

for declared C4996: ‘sprintf’ was declared deprecated or warning C4996: ‘strcpy’ was declared deprecated if used in vs2003, vs2005 or vs2019. Here are some ways to solve the problem. Method 1: call those non-standard functions with the suffix “_s” advocated by VS2005, followed by “_s”, as sprintf is changed to sprintf_s.
method 2: add #define _CRT_SECURE_NO_DEPRECATE or #pragma warning(disable:4996) at the beginning of the file, which isa method of ignoring warnings (which is rarely used).
method 3: dry substance set in the project properties (recommended).

is set in the Project property as follows:

opens project-settings –Resources– Preprocessor definitions for VC6:
, and adds _CRT_SECURE_NO_DEPRECATE and _SCL_SECURE_NO_DEPRECATE macros to
.

version for VS series:
open project, the project properties – configuration properties – C/C + + preprocessor definition pretreatment,
add _CRT_SECURE_NO_DEPRECATE and _SCL_SECURE_NO_DEPRECATE both macro.