#include < stdio.h >
#include < string.h >
int main()
{
unsigned char a;
FILE *P;
P=fopen("mola.txt","r");
while((a=getc(P))!=EOF)
printf("%c",a);
}
Whats wrong with these code? When I compile it gives warning “comparison is always true due to limited range of data type.” What does that warning mean?
You are storing the result of
getcin achar. It should be anint. There’s also a C FAQ on it. Also you should check the return value of thefopen.Also the
whilelooks fishy. Try indenting ?