Question: Change the C program below so that it does not use the #include #include #define _GNU_SOURCE imports. Do not just copy the same exact code

Change the C program below so that it does not use the #include #include #define _GNU_SOURCE imports. Do not just copy the same exact code as the answer. The only import allowed is #include stdio.h. The new program must still produce the same output as the code below.

#include #include #include #define _GNU_SOURCE int main(char *argc, char* argv[]) { const char *file = argv[1]; FILE *ptr; char * line = NULL; size_t len = 0; ssize_t read; char filename[1000],c; char buffer[1000]; int i; ptr=fopen(file,"r"); if(ptr==NULL) { printf("cannot open the file "); exit(0); } while ((read = getline(&line, &len, ptr)) != -1) { char buffer[1000]; int found = 0; for(i=0;line[i]!='\0';i++){ if(found ==0 && line[i]==' ') { printf(" "); found = 1; continue; } if(line[i]!=' '){ if(line[i]==' '){ printf(" "); found = 1; } else{ printf("%c",line[i]); found =0; } } } } fclose(ptr); return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!