c(7) :warning C4996:'gets':This function or variable may b vc2008#include#includemain(){FILE *fp;char str[81],name[10];gets(name);if((fp=fopen(name,"w"))==NULL){printf("can not open\n");exit(0);}gets(name);fputs(str,fp);flose(fp);if((fp=fopen(name,"r

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/07 21:44:49
c(7):warningC4996:''gets'':Thisfunctionorvariablemaybvc2008#include#includemain(){FILE*fp;charstr[81],

c(7) :warning C4996:'gets':This function or variable may b vc2008#include#includemain(){FILE *fp;char str[81],name[10];gets(name);if((fp=fopen(name,"w"))==NULL){printf("can not open\n");exit(0);}gets(name);fputs(str,fp);flose(fp);if((fp=fopen(name,"r
c(7) :warning C4996:'gets':This function or variable may b vc2008
#include
#include
main()
{
FILE *fp;
char str[81],name[10];
gets(name);
if((fp=fopen(name,"w"))==NULL)
{
printf("can not open\n");
exit(0);
}
gets(name);
fputs(str,fp);
flose(fp);
if((fp=fopen(name,"r"))==NULL)
{
printf("canfhhkjadf\n");
exit(0);
}
fgets(str,strlen(str)+1,fp);
printf("oiehjhsdhfkjdf\n");
puts(str);
fclose(fp);
}
1>d:\my documents\visual studio 2008\projects\们渴望你的\们渴望你的\了房间.c(7) :warning C4996:'gets':This function or variable may be unsafe.Consider using gets_s instead.To disable deprecation,use _CRT_SECURE_NO_WARNINGS.See online help for details.
1> d:\program files\vc\include\stdio.h(279) :参见“gets”的声明
1>d:\my documents\visual studio 2008\projects\们渴望你的\们渴望你的\了房间.c(8) :warning 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> d:\program files\vc\include\stdio.h(237) :参见“fopen”的声明
1>d:\my documents\visual studio 2008\projects\们渴望你的\们渴望你的\了房间.c(13) :warning C4996:'gets':This function or variable may be unsafe.Consider using gets_s instead.To disable deprecation,use _CRT_SECURE_NO_WARNINGS.See online help for details.
1> d:\program files\vc\include\stdio.h(279) :参见“gets”的声明
1>d:\my documents\visual studio 2008\projects\们渴望你的\们渴望你的\了房间.c(15) :warning C4013:“flose”未定义;假设外部返回 int
1>d:\my documents\visual studio 2008\projects\们渴望你的\们渴望你的\了房间.c(16) :warning 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> d:\program files\vc\include\stdio.h(237) :参见“fopen”的声明
1>d:\my documents\visual studio 2008\projects\们渴望你的\们渴望你的\了房间.c(21) :warning C4013:“strlen”未定义;假设外部返回 int
1>正在链接...
1>了房间.obj :error LNK2019:无法解析的外部符号 _flose,该符号在函数 _main 中被引用
1>d:\My Documents\Visual Studio 2008\Projects\们渴望你的\Debug\们渴望你的.exe :fatal error LNK1120:1 个无法解析的外部命令

c(7) :warning C4996:'gets':This function or variable may b vc2008#include#includemain(){FILE *fp;char str[81],name[10];gets(name);if((fp=fopen(name,"w"))==NULL){printf("can not open\n");exit(0);}gets(name);fputs(str,fp);flose(fp);if((fp=fopen(name,"r
fclose写成flose了!
gets有溢出风险,可改成fgets.
改法见注释:
#include
#include
main()
{
FILE *fp;
char str[81],name[10];
gets(name);
if((fp=fopen(name,"w"))==NULL)
{
printf("can not open\n");
exit(0);
}
gets(name); /* 这里改成 fgets(name,sizeof(name),stdin); */
fputs(str,fp);
flose(fp); /* 这里写错了!应该是fclose(fp); */
if((fp=fopen(name,"r"))==NULL)
{
printf("canfhhkjadf\n");
exit(0);
}
fgets(str,strlen(str)+1,fp);
printf("oiehjhsdhfkjdf\n");
puts(str);
fclose(fp);
}

c(7) :warning C4996:'gets':This function or variable may b vc2008#include#includemain(){FILE *fp;char str[81],name[10];gets(name);if((fp=fopen(name,w))==NULL){printf(can not open );exit(0);}gets(name);fputs(str,fp);flose(fp);if((fp=fopen(name,r warning C4996:'scanf':This function or variable may be unsafe.Consider using scanf_s instead.To disable deprecation,use _CRT_SECURE_NO_WARNINGS.为什么是不安全的? CES.C(13):warning C276:constant in condition expression warning是什么意思 general warning Final Warning warning C4552:' warning C4552:' FBL WARNING 请问C语言中这个警告是什么意思?warning C4129:'c' :unrecognized character escape sequence There were signs here and there,____visitors to look out for_____rocks.A.warning:fallen B.warning:falling C.warned:fallling D.to warn:fallen There were signs here and there,_____visitors to look out for ____rocks.A warning,fallen B warning,falling c warned,falling d to warm,fallen为什么 WARNING什么意思WARNING是英文, 为会么我的KEIL中打不开 can't open file 'compiler_defs.h'显示的题是main.c(11): warning C318: can't open file 'compiler_defs.h'main.c(12): warning C318: can't open file 'C8051T600_defs.h'是怎么回事? protel99 Warning:Net name CS_0 has been changed to CS结果为:(CS_0J1-7U1-61) LESSON1.C(18):warning C206:'delay':missing function-prototype怎么解决,我应经进行函数声明了 sound like ( )an order or a warning a.to give b.giving c.gives d.gavesound like 的用法! FBI WARNING是什么?