小编Dea*_*ate的帖子

"获取"的隐含声明

我理解"隐式声明"通常意味着在调用函数之前必须将函数置于程序的顶部,或者我需要声明原型.
但是,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);
   }
}
Run Code Online (Sandbox Code Playgroud)

c linux gets

9
推荐指数
2
解决办法
3万
查看次数

标签 统计

c ×1

gets ×1

linux ×1