VS2019 error C4996: ‘scanf‘: This function or variable may be unsafe 错误

简介: VS2019 error C4996: ‘scanf‘: This function or variable may be unsafe 错误

一、异常错误


 - 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.


二、原因


  • 安全检测


  • 错误C4996:“scanf”:此函数或变量可能不安全。考虑改用scanf_s。要禁用否决,请使用_CRT_SECURE_NO_WARNINGS。有关详细信息,请参阅联机帮助。


三、解决方法


1.替换scanf函数


  • 采用scanf_s结尾的安全版本


2.添加宏定义


  • 在头文件包含的最前面,include的前面


  • 加上:#define _CRT_SECURE_NO_WARNINGS宏定义即可


3.关闭安全开发生命周期(SDL)检查



目录
相关文章
|
Java 关系型数据库 数据库连接
java中调用postgis的函数找不到,报错[42883] ERROR: function st_area(public.geometry) does not exis,Navicat里面正常
今天在postgresql数据库中对一个图层表使用st_area()函数,获取图层中geometry字段的面积。
|
27天前
|
Python
【Azure 应用服务】Azure Function HTTP Trigger 遇见奇妙的500 Internal Server Error: Failed to forward request to http://169.254.130.x
【Azure 应用服务】Azure Function HTTP Trigger 遇见奇妙的500 Internal Server Error: Failed to forward request to http://169.254.130.x
|
27天前
【Azure 应用服务】Azure Function 启用 Managed Identity后, Powershell Funciton出现 ERROR: ManagedIdentityCredential authentication failed
【Azure 应用服务】Azure Function 启用 Managed Identity后, Powershell Funciton出现 ERROR: ManagedIdentityCredential authentication failed
|
2月前
|
前端开发
Error in created hook: “TypeError: _test.default is not a function
Error in created hook: “TypeError: _test.default is not a function
|
4月前
|
Go
Error: Package awesomeProject contains more than one main function Consider using File kind instead
Goland编辑器运行时出现“edit configuration”窗口,阻碍代码执行。解决方法:右键点击源文件运行。问题源于Go语言不支持函数重载,同一包内不能有两个同名函数,导致多入口冲突。初学者在main包中使用了多个Go源文件,应改为仅有一个源码文件来避免此问题。
47 0
|
10月前
Fatal error: Call to undefined function openssl_pkey_get_private()
Fatal error: Call to undefined function openssl_pkey_get_private()
61 0
error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘
error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘
103 0
|
4月前
|
前端开发 API UED
Spartacus SSR 期间使用 browser function 会导致 error,回退到 CSR
Spartacus SSR 期间使用 browser function 会导致 error,回退到 CSR
|
4月前
|
计算机视觉 Python
error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
137 0
|
9月前
|
安全 C语言
警告 1 warning C4996: ‘scanf‘: This function or variable may be unsafe.
警告 1 warning C4996: ‘scanf‘: This function or variable may be unsafe.

热门文章

最新文章