#define BUFF_SIZE 42 #define READ_SIZE 42 char *get_next_line(int fd) { static char buff_read[BUFF_SIZE]; static int repeat; static char *line; static int i; line = (char *)malloc(sizeof(line) * 42); i = 0; repeat = read(fd, buff_read, READ_SIZE); while (42) { while (buff_read[i]) { if (buff_read[i] == '\n') return (0); my_putchar(buff_read[i]); i++; } if (buff_read[i] != '\n' && buff_read[i]) my_putstr("Error."); } repeat++; } int main() { get_next_line(0); get_next_line(0); }