今天编写控制台应用程序时出现如下错误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
昨天使用Android Studio虚拟机发现所有虚拟机的状态都变为不可用,右下角提示
consider using a system image with Google APIs to enable testing with Google Play Services
谷歌翻译结果是
考虑使用与谷歌API的系统映像,以使测试与谷歌播放服务
【
问题
描述】
在Visual Studio
中
使用功能‘
fopen
’操作文件时,出现以下
错误
:
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.
【
问题
分析】
编译的信息表明‘
fopen
’不安全,推荐使用‘f
声明FILE *
fopen
(const char *filename, const char *mode)
使用给定的model打开filename文件
该函数返回一个 FILE 指针,否则返回 NULL空指针
解决
方法:
菜单栏>项目>属性>C/C++>预处理器>预处理器定义>编辑>先加分号; 再加_CRT_SECURE_NO_WARNINGS>确定即可