Home Backend Development C#.Net Tutorial VS uses scanf to report errors and their solutions

VS uses scanf to report errors and their solutions

May 10, 2017 am 11:00 AM

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 of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve 'undefined: fmt.Scanf' error in golang? How to solve 'undefined: fmt.Scanf' error in golang? Jun 24, 2023 pm 06:47 PM

When using Go language, we may encounter "undefined:fmt.Scanf" error. This error usually occurs when we try to use the Scanf function of the fmt package and for some reason this function is not recognized. In the Go language, the fmt package is a very important package and contains many functions for formatting input and output. Among them, the Scanf function is a function used to read data in a specified format from standard input. If we want to read

How to solve the problem that scanf return value is ignored How to solve the problem that scanf return value is ignored Nov 14, 2023 am 10:01 AM

Solutions to the ignored return value of scanf include checking the return value of scanf, clearing the input buffer, and using fgets instead of scanf. Detailed introduction: 1. Check the return value of scanf. You should always check the return value of the scanf function. The return value of the scanf function is the number of successfully read parameters. If the return value is inconsistent with the expected one, it means that the input is incorrect; 2 , Clear the input buffer. When using the scanf function, if the input data does not match the expected format, the data in the input buffer will be lost, etc.

Share optimization tips for the input format of the C language scanf function Share optimization tips for the input format of the C language scanf function Feb 18, 2024 am 10:46 AM

C language scanf input format optimization tips are shared in C language. We often need to obtain data from user input. The scanf function is a commonly used input function. However, there are some details that need to be paid attention to when using the scanf function to ensure that the input data can be read and processed correctly. This article will share some tips for optimizing the scanf input format and give specific code examples. Using the format character: The format character is a character used by the scanf function to specify the type of data to be read. Common format characters are:

In-depth understanding of the input format control of the scanf function in C language In-depth understanding of the input format control of the scanf function in C language Feb 18, 2024 am 11:49 AM

A thorough understanding of the input format control of the scanf function in C language requires specific code examples. In C language, the scanf function is a commonly used input function that allows us to read data from user input and store it in variables. In order to better control the input format, the scanf function provides input format control characters, through which we can specify the input data type and some specific format requirements. Below we use some specific code examples to explain the input format control of the scanf function in detail.

Example and analysis: input format of scanf function in C language Example and analysis: input format of scanf function in C language Feb 20, 2024 am 09:58 AM

C language is a very important programming language. Many beginners often use the input function scanf() in the process of learning and using C language. Through the scanf() function, we can obtain input data from the user and then store it in the specified variable. This article will introduce the input format examples and analysis of scanf(), and provide you with specific code examples. In C language, the format control string of the scanf() function is used to specify the format of the input data. Below we will discuss different types of

In-depth understanding of the scanf input format in C language In-depth understanding of the scanf input format in C language Feb 18, 2024 pm 11:56 PM

C language is a widely used programming language, and input is a very important part of the programming process. In C language, the scanf function is a function used to receive data from an input stream. This article will introduce the input format of the scanf function in detail and further explain it through specific code examples. When using the scanf function for input, we need to use different format control characters to specify the input data type. The following are some commonly used format control characters and their corresponding data types: %d: used to receive integer data. %f:

Usage and precautions of scanf function in C language Usage and precautions of scanf function in C language Feb 21, 2024 pm 05:33 PM

The usage and precautions of the scanf function in C language. As one of the most commonly used input functions in C language, the scanf function plays an important role in program development. It can receive user input data from the standard input stream (keyboard) and store it in the specified variable. This article will introduce the usage of the scanf function and some matters needing attention, and provide specific code examples. Basic usage of scanf function The prototype of scanf function is as follows: intscanf(constchar*f

Implement data input and processing in C language through scanf function Implement data input and processing in C language through scanf function Feb 25, 2024 pm 08:27 PM

Title: Using the scanf function to implement data input and processing in C language. In C language, the scanf function can be used to easily implement data input and processing. The scanf function is a function in the C language standard library. Its function is to read data from the standard input (usually the keyboard) and store the read data into the specified variable in the specified format. The following will use specific code examples to illustrate how to use the scanf function for data input and processing. First, we need to introduce the basis of the scanf function

See all articles