error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead解决方案
2015-04-23 10:45
501 查看
vs2012使用c语言函数fopen操作文件时报错:
解决方案:
第一种是在使用fopen函数的源文件第一行增加:
第二种做法是更改VS2012项目配置:
项目 ->属性 -> c/c++ -> 预处理器 ,点击预处理器定义,加入_CRT_SECURE_NO_WARNINGS
错误 1 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. c:\users\root\desktop\vc_pro\vc\tinyxml2\exam1\exam1.cpp 28 1 exam1
解决方案:
第一种是在使用fopen函数的源文件第一行增加:
#define _CRT_SECURE_NO_WARNINGS
第二种做法是更改VS2012项目配置:
项目 ->属性 -> c/c++ -> 预处理器 ,点击预处理器定义,加入_CRT_SECURE_NO_WARNINGS
相关文章推荐
- error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead解决方案
- error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation
- error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead解决方案
- : error C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
- VS2015:error C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead
- error C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead
- error C4996: 'asctime': This function or variable may be unsafe. Consider using asctime_s instead
- This function or variable may be unsafe. Consider using fopen_s instead
- 错误 1 error C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use . See online help for details.
- 问题error C4996: 'asctime': This function or variable may be unsafe. Consider using asctime_s instead
- error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To d
- 已解决error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead.
- VS2013提示error C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead.
- error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead.
- 错误 1 error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead.
- 错误 1 error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead.
- vs2013出现错误提示error C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s
- warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead.
- warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead