This function or variable may be unsafe Consider using xxx instead
问题:
在Visual C++ 6.0 以下执行正常的代码放到Visual Studio 20xx系列里就跑不动了,有时候会提演示样例如以下错误:
error C4996: 'fopen': This function or variable may be unsafe. Consider using
fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
解决方式:
有两种解决方法:
1、依照提示说的做,把fopen换成fopen_s(类似的错误一般都是提示xxx函数不安全。加个后缀_s就能够解决的)。可是加完了你可能会发现...參数类型不匹配了,所以还要改參数类型,非常麻烦有没有!所以有了另外一种方法!
2、以Visual Studio 2012为例,打开工程后,选择Project -> project name Properties... -> Configuration Properties -> C/C++ -> Command
Line 在以下的Additional Options 加上这一句:/D "_CRT_SECURE_NO_DEPRECATE" 然后确定就能够了,又一次编译程序就没有警告了!
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvRVhMc3Vuc2hpbmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="">
This function or variable may be unsafe Consider using xxx instead的更多相关文章
- vs2012 error c4996: This function or variable may be unsafe
编译lua源码时,使用vs2012,遇到如下错误. 1>------ 已启动生成: 项目: 20130925, 配置: Debug Win32 ------ 1> stdafx.cpp ...
- 配置OpenCV产生flann\logger.h(66): error C4996: 'fopen': This function or variable may be unsafe问题[zz]
使用vs2012/2013配置opencv编译出现问题: 1>------ 已启动生成: 项目: Win32ForOpenCV245, 配置: Debug Win32 ------ 1> ...
- error C4996: 'fopen': This function or variable may be unsafe.
vs2013中错误提示信息: error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s ...
- [转] This function or variable may be unsafe
原文:This function or variable may be unsafe,他大姨妈 错误提示: [Error]'fopen' This function or variable may b ...
- Visual Studio 2015 编译错误【错误 C4996 'vsprintf': This function or variable may be unsafe. Consider using vsprintf_s instead. 】的解决方案
错误提示信息: 错误 C4996 'vsprintf': This function or variable may be unsafe. Consider using vsprintf_s inst ...
- 解决VS2013中“This function or variable may be unsafe”的问题
1.在VS2013中编译代码时出现如上错误信息,下面就介绍下如何解决This function or variable may be unsafe的问题. 2.用VS2013打开出现错误的代码文件 3 ...
- This function or variable may be unsafe. Consider using scanf_s instead.
去掉安全检查,开头加上即可: #define _CRT_SECURE_NO_WARNINGS 或者: 严重性代码 说明项目文件行禁止显示状态 错误C4996 'scanf': This functio ...
- 删除: warning C4996: 'sprintf': This function or variable may be unsafe. Consider 方法
可以使用的最简单的方法: 选项Project | Configuration Properties | C/C++ | Preprocessor | Preproc ...
- error C4996: 'strcpy': This function or variable may be unsafe.
vs2012用strcpy遇到的错误. 错误描述:error C4996: 'strcpy': This function or variable may be unsafe. Consider us ...
随机推荐
- async异步注解和aspect切面注解等注解的原理
在我们使用spring框架的过程中,在很多时候我们会使用@async注解来异步执行某一些方法,提高系统的执行效率.今天我们来探讨下spring是如何完成这个功能的. 1.spring 在扫描bean的 ...
- Project Euler Problem5
Smallest multiple Problem 5 2520 is the smallest number that can be divided by each of the numbers f ...
- poj1521
霍夫曼编码,建树 #include <cstdio> #include <cstring> #include <queue> using namespace std ...
- testng运行失败,继续执行
1.重写断言类 public class Verify { public static StringBuffer verificationErrors= new StringBuffer();; pu ...
- css-通过hover实现鼠标进过背景色变化
通过hover实现鼠标进过背景色变化 <!DOCTYPE html> <html lang="en"> <head> <meta cha ...
- LeetCode(18):四数之和
Medium! 题目描述: 给定一个包含 n 个整数的数组 nums 和一个目标值 target,判断 nums 中是否存在四个元素 a,b,c 和 d ,使得 a + b + c + d 的值与 t ...
- LeetCode(12):整数转罗马数字
Medium! 题目描述: 罗马数字包含以下七种字符: I, V, X, L,C,D 和 M. 字符 数值 I 1 V 5 X 10 L 50 C 100 D 500 M 1000 例如, 罗马数字 ...
- 使用Ocelot构建GateWay
添加Nuget包:Ocelot 添加配置文件Ocelot.json 具体配置可以看另一篇Ocelot配置 Json配置文件主要包含两个根节点: ReRoutes:路由重定向配置 都是数组结构 可以配置 ...
- 富文本编辑器&FileReader
最近在做一个web版的管理Tool,其中包括一个编辑框,要求能够编辑文字,插入图片,最后导出做成一个Html.对于资深人士看来,这很容易啊,不就是一个富文本编辑框吗?这其实就是一个概念的问题,对有经验 ...
- linux 时间戳
一.https://www.cnblogs.com/33debug/p/6632172.html 二.显示前一小时时间 date -d '-1 hour' '+%F-%H-%M-%S'