#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE* fp = fopen("d:\\data.txt", "r");
if (!fp) {
perror("File opening failed");
return -1;
}
int ch;
while ((ch = fgetc(fp)) != EOF) {
putchar(ch);
}
if (ferror(fp))
puts("\nFile reading error");
else if (feof(fp))
puts("\nEnd of file reached successfully");
fclose(fp);
}
/*
run:
c c++ c#
java python
javascript php
End of file reached successfully
*/