它创建一个名为fp的局部变量(类型为FILE *),并且forward声明为
an external function named fopen (with a signature of FILE *fopen()).
C中fopen函数声明中缺少参数并不意味着函数采用零参数(函数签名将为FILE * fopen(void)).相反,缺少参数意味着函数具有未指定的参数(数量未指定且类型未指定).
这是一种非常古老的C形式,在现代C中更具惯用性:
#include // fopen() and fprintf()
#include // exit()
#include // strerror()
#include // errno
extern char *progname;
FILE *efopen(const char *file, const char *mode) {
FILE *fp = fopen(file, mode);
if (fp) return fp;
fprintf(stderr, "%s: can't open file %s in mode %s: %s\n",
progname, file, mode, strerror(errno));
exit(1);
}