/* Checks whether a text file contains characters in the octal range 200 to 237, and reports the occurrences (and returns EXIT_FAILURE) if it does. */ #include #include int main(void) { int found = 0; int line = 1; int ch; while( (ch=getchar()) != EOF) if(ch == '\n') line++; else if(ch >= 0200 && ch <= 0237) { found = 1; fprintf(stderr, "Illegal character (octal %o) at line %d.\n", ch, line); } return found == 0 ? EXIT_SUCCESS : EXIT_FAILURE; }