This article mainly introduces in detail the solution to error reporting using scanf in VS2015. It has certain reference value. Interested friends can refer to it.
The example in this article shares with you the use of scanf in VS2015. The solution to the error is for your reference. The specific content is as follows
1. Add:
#define_CRT_SECURE_NO_DEPRECATE
at the beginning of the program. 2. In the program Add at the front:
#pragma warning(disable:4996)
3. Change scanf to scanf_s;
4. There is no need to add that line of code at the front of the program, just uncheck "SDL Check" when creating a new project;
5 , If the project has been established, you can also turn off SDL in the project properties ; the VS I use is the Chinese version
(1), I Change "Yes" to "No", and when compiling the same code, the following warning appears, which is not an error:
(2). If you do not change it, it is an error. , not a warning:
#6. Just set it up in the project: put the macro definition that reports the error in: Project Properties-----C/C++--- -Preprocessor------Preprocessor definition
7. Add in the project properties----C/C++----command line: /D _CRT_SECURE_NO_WARNINGS will do.
【Related Recommendations】
2. ASP Tutorial
3. Li Yanhui ASP basic video tutorial
The above is the detailed content of VS uses scanf to report errors and their solutions. For more information, please follow other related articles on the PHP Chinese website!