/** * Extending reader1 to close all open file descriptors * * @author gtowell * Created: March 2021 * **/ #include #include #include int main(int argc, char* argv[]) { char* a[400]; FILE* f = fopen(argv[1], "r"); if (!f) { fprintf(stderr, "No such file\n"); return 1; } char line[256]; int linecount=0; while (fgets(line, 256, f)) { int llen = strlen(line); char* nline = malloc((llen+1)*sizeof(char)); strcpy(nline, line); a[linecount++]=nline; } for (int i=0; i