Error:
To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
Error 1 error C4996: 'sscanf': This function or variable may be
unsafe. Consider using sscanf_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
Error 1 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.
Solution:
Go to Project -> Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions and add _CRT_SECURE_NO_WARNINGS in the list.
This Visual C++ warning, C4996, flags standard C functions such as sscanf and fopen as unsafe because they do not bound their buffers, and MSVC suggests the _s secure variants instead.
You can switch to the suggested secure functions, or define _CRT_SECURE_NO_WARNINGS to silence the warning once you have reviewed the usage. Portable code often keeps the standard functions and disables the warning.


No comments:
Post a Comment
Note: Only a member of this blog may post a comment.