C语言初学者,visual studio2015 环境下,项目:win32控制台应用程序,使用打开文件及其它函数出现错误,求大神解决及解释。
#include <stdio.h>#include <string.h>
int main()
{
FILE *fp = fopen_s("1.txt", "a+");
if (fp == 0) { printf("can't open file\n"); return 0; }
fseek(fp, 0, SEEK_END);
char sz_add[] = "hello world\n";
fwrite(sz_add, strlen(sz_add), 1, fp);
fclose(fp);
return 0;
}
编译运行后结果:
错误 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.
错误 MSB6006 “CL.exe”已退出,代码为 2。 xxx C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets 356
请问这是怎么回事,求解释