The EOF is defined in my stdio.h like below (mingw32)
Code:
/* Returned by various functions on end of file condition or error. */
#define	EOF	(-1)
it is simply equal to signed int. But the code above includes something like "unsigned char". See the working example I sent.