You probably want this:
FILE *myOpenFile(const char *filename) {
FILE *File = fopen(filename, "r");
if (File == NULL) {
printf("Error");
exit(0);
}
return File;
}
int main() {
FILE *myFile = myOpenFile("cisfile.txt");
// read something from myFile using fread, fgets, fscanf, etc.
fclose(myFile);
}
I renamed some of your identifiers so the program compiles, makes sense and is less confusing.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…