I have to recode an implementation of the getline() function, but using the file descriptor of the file and not a FILE *. I am only allowed to use
getline()
FILE *
I am concerned about this line:
remaining = remaining + i + 1;
remaining is a pointer to the allocated buffer. On this line, you destroy it, which means that you cannot free() it anymore.
remaining
free()