我明白'隱式聲明'通常意味着函數在調用之前必須放在程序的頂部,或者我需要聲明原型。
但是,gets
應該在stdio.h
文件(我已包括)。
有什麼辦法解決這個問題嗎?隱式聲明'gets'
#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);
}
}
請顯示您的代碼。 – kaylum
你的代碼是什麼?你如何編譯它,你使用的理由是什麼? – PSkocik
查看http://stackoverflow.com/help/mcve獲取關於如何生成示例代碼的靈感 –