May it be a file, stdin or a network connection, get_next_line function will read content line by line.
Calling get_next_line in a loop will allow you to read the text available on the file descriptor one line at a time.
Function | Description | External functions |
---|---|---|
get_next_line | Returns a line read from a file descriptor. | read, malloc, free |
To compile the program, modify the BUFFER_SIZE value xx
.
gcc -Wall -Wextra -Werror -D BUFFER_SIZE=xx get_next_line.c get_next_line_utils.c
Use only one static variable and handle multiple file descriptors without losing the reading thread.