#include #include int contains_lowercase(char *path); int main(int argc, char *argv[]) { if (argc <= 1) { fprintf(stderr, "Usage: %s \n", argv[0]); return 1; } int result = contains_lowercase(argv[1]); if (result != -1) { printf("Contains %c\n", result); } else { printf("Does not contain lowercase\n"); } return 0; } // Check whether the given file contains a byte that could represent lowercase ascii // Return the first lowercase byte found. // Return -1 otherwise int contains_lowercase(char *path) { FILE *f = fopen(path, "r"); if (f == NULL) { perror(""); return -1; } int curr_byte; while ((curr_byte = fgetc(f)) != EOF){ if (curr_byte >= 'a' && curr_byte <= 'z') { fclose(f); return curr_byte; } } fclose(f); return -1; }