I am a bit confused about how to modify my code to return a buffer that stores multiple lines of a file as a string and not just the first line.
char * readFile ( char * filename){
char text[500];
char * input=NULL;
FILE *fptr;
fptr=fopen(filename,"r");
if (fptr == NULL) {
return NULL;
}
fgets(text, 500, fptr);
fclose(fptr);
input=malloc(sizeof(char)*(strlen(text)+1));
if (input == NULL) {
return NULL;
}
strcpy(input,text);
return input;
}