我知道'implicit declaration'通常意味着在调用函数之前必须将函数置于程序顶部,或者我需要声明原型。
然而,gets
应该在 stdio.h
文件中(我已经包含了它)。
有什么方法可以解决这个问题吗?
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char ch, file_name[25];
FILE *fp;
printf("Enter the name of file you wish to see\n");
gets(file_name);
fp = fopen(file_name,"r"); // read mode
if( fp == NULL )
{
perror("Error while opening the file.\n");
exit(EXIT_FAILURE);
}
}