No Problem
The EOF character is only a reading concept for some file input fuctions which return characters one at a time. For instance if you use fgetc and it returns you the EOF character, you might be at the end of the file but you will not know until you check with a call to feof. Reading EOF from a file is not a problem when using functions like fread, it's just another character.
#include <stdio.h>
#include <stdlib.h>
int main()
{
char buff[100] = { '\0' };
FILE *fp;
fp = fopen("blahblah","w");
fprintf(fp,"Hello%c World\n",EOF);
fclose(fp);
fp = fopen("blahblah");
fread(buff,1,100,fp);
printf("%s",buff);
fclose(fp);
}
|