VS error --- error: c4996

出现: error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

it means:

fopen is not safe, it is recommended that you use fopen_s, of course you are too lazy to change == at this time, so directly consider shielding the security error report.

Since Microsoft does not recommend using the traditional C library functions scanf, strcpy, sprintf, etc. in VS, using these library functions directly will prompt C4996 error.
VS recommends using functions with _s, such as scanf_s, strcpy_s, but these are not standard C functions.

Solution:

(1) Add #pragma warning(disable:4996) in front of all #include 

or:

(2) Find [Project Properties], click [Preprocessor] in [C++], edit [Preprocessor], and add a piece of code in it: _CRT_SECURE_NO_WARNINGS.

Guess you like

Origin blog.csdn.net/bigger_belief/article/details/131128228
Recommended