Home  >  Article  >  Backend Development  >  VS uses scanf to report errors and their solutions

VS uses scanf to report errors and their solutions

Y2J
Y2JOriginal
2017-05-10 11:00:564023browse

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】

1. ASP Free Video Tutorial

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn