The program below works fine on various versions of Solaris / Linux, but not on AIX. However, if I replace while(c!=EOF) with while(c!=0xff) on AIX, it works completely fine.
Any thoughts? I checked the fgetc man page on AIX and should return an EOF constant!
#include <stdio.h> #include<unistd.h> #include <string.h> int main() { char c; FILE *fp; fp = fopen("a.txt", "r"); c=fgetc(fp); while(c!=EOF) { c=fgetc(fp); printf("%d",c); } fclose(fp); return 0; }
c types eof aix fgetc
raxit
source share