I wrote the following little test program to test out the isalpha function:
And ran it using this as my input text file:
main(int argc, char * argv )
FILE * fp = fopen( argv, "r" );
printf( "%d\n%d\n%d\n%d\n", isalpha(fgetc(fp)), isalpha(fgetc(fp)), isalpha(fgetc(fp)), isalpha(fgetc(fp)));
And got the following output:
According to what I've read, the isalpha function should produce non-zero values when given the letters 'a' and 'b', and it should produce zero when given '&' and '-'. This is the exact opposite of what the above code shows. Can someone tell me what's going on? Could there be a bug in this function? I'm using gcc to compile.