error C4996: 'scanf': This function or variable may be unsafe in c programming
Another way is when you create a new project, you don't click to Security Development Lifecycle (SDL) checks:
Or if you are in a project:
Right-click your project->Properties->Configuration Properties->C/C++ ->All Options>
Sroll your mouse and find SDL checks
, you edit it to NO(/sdl-)
, then Apply, OK
You can add "_CRT_SECURE_NO_WARNINGS" in Preprocessor Definitions.
Right-click your project->Properties->Configuration Properties->C/C++ ->Preprocessor->Preprocessor Definitions.
Another way to suppress the error: Add this line at the top in C/C++ file:
#define _CRT_SECURE_NO_WARNINGS
It sounds like it's just a compiler warning.
Usage of scanf_s
prevents possible buffer overflow.
See: http://code.wikia.com/wiki/Scanf_s
Good explanation as to why scanf
can be dangerous: Disadvantages of scanf
So as suggested, you can try replacing scanf
with scanf_s
or disable the compiler warning.