✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
The following code:
char* myreader(int fd){ int cmp = 0; char c; while(read(fd, &c, 1) == 1 && c!= '\n') cmp++; char *ch = (char*) malloc (cmp+1); lseek(fd, 0, SEEK_SET); read(fd, ch, cmp); ch[cmp] = 0; return ch; }