It Looks like you might be accessing locations in memory that contain characters, Change your code to
char buffer[4096] = {};
memset(buffer, 0, 4096);
while(NULL!=fgets(buffer, sizeof(buffer), fp)){
if (digitTest(buffer, strlen(buffer)) == 0){ //get actual length of buffer
printf ("contains alpha\n");
continue;
EDIT
In order to make your code not respond to either \n
or \r
do
bool digitTest(char *test, int arysize)
{
int i;
for (i =0; i<arysize; i++)
{
if( test[i] == '\r' || test[i] == '\n')
return 1;
if ((isalpha(test[i])) != 0){
return 0;
}
if (i==arysize)
return 1;
}
return 1;
}