#include <stdio.h>
int main()
{
int a;
scanf("%d", &a);
printf("%d",a);
return 0;
}
When we write a simple C code on vs2019, there is such an error, saying that the scanf function is not safe
Adding #define _CRT_SECURE_NO_WARNINGS 1 in the macro will not report an error, but it is too troublesome to add it manually in each project. Next, I will give you a once-and-for-all method
First prepare a code editor Notepad++, the download link is below
Next, find the file newc++file.cpp under the installation path of vs2019. My path is D:\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\VCProjectItems
or directly in the search bar
Right click to open with Notepad++
Then put this sentence in the first line, and then save it
#define _CRT_SECURE_NO_WARNINGS 1
At this time, the code will not report an error
And the statement will automatically appear on the first line of a new file