【发布时间】:2016-03-06 00:45:29
【问题描述】:
我了解“隐式声明”通常意味着函数必须在调用它之前放在程序的顶部,或者我需要声明原型。
但是,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);
}
}
【问题讨论】:
-
请出示您的代码。
-
你的密码是什么?你是如何编译它的,你使用gets的原因是什么?
-
查看stackoverflow.com/help/mcve 获取有关如何生成示例代码的灵感