c:code二分查找二分查找source.cpp(11): error C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:program files (x86)microsoft visual studio 12.0vcincludestdio.h(283) : see declaration of 'scanf'
If you can speak English, you should be able to understand the compiler prompts. Starting from a certain version of VS, most of the input and output functions in the original stdio, such as printf, are marked as unsafe. It used to be a warning. It is possible It's because you turned on -Wall, or it may be that the error is forced directly now. Just switch to a safe version like printf_s. The usage is basically similar. For details, you can check msdn
What is written upstairs is not the point. The point is that C++11’s strict overflow check solution for strings: you just need to replace scanf with scanf_s
VS2013 has mandatory security checks. scanf is an unsafe function. It is recommended to use scanf_s in the c+11 standard. If you don’t want to use it, you can #define _CRT_SECURE_NO_WARNINGS at the beginning of the header to skip the security check!
c:code二分查找二分查找source.cpp(11): error C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:program files (x86)microsoft visual studio 12.0vcincludestdio.h(283) : see declaration of 'scanf'
If you can speak English, you should be able to understand the compiler prompts. Starting from a certain version of VS, most of the input and output functions in the original stdio, such as printf, are marked as unsafe. It used to be a warning. It is possible It's because you turned on -Wall, or it may be that the error is forced directly now. Just switch to a safe version like printf_s. The usage is basically similar. For details, you can check msdn
What is written upstairs is not the point. The point is that C++11’s strict overflow check solution for strings: you just need to replace scanf with scanf_s
Header file<cstdio.h>
VS2013 has mandatory security checks. scanf is an unsafe function. It is recommended to use scanf_s in the c+11 standard. If you don’t want to use it, you can #define _CRT_SECURE_NO_WARNINGS at the beginning of the header to skip the security check!