Open the file: fopen()
#include <stdio.h>
void main() {
FILE *fp;
char ch;
fp = fopen("file\_handle.c", "r");
while (1) {
ch = fgetc(fp);
if (ch == EOF)
break;
printf("%c", ch);
}
fclose(fp);
}
After performing all operations on the file, the file must be closed with fclose()
Comments