This project is about programming a function that returns a line read from a file descriptor.
Get_next_line function reads from a file descriptor and returns the first line encountered, in other words when encountering a line break character \n
. The function uses static variables to "remember" the last line ret and continue from that point.
When compiling you should compile with
-D BUFFER_SIZE=nbr
. Where nbr is the numbers of bytes that read function read each time.
- The Allowed functions are:
read, malloc, free
- Files nedded: get_next_line.cget_next_line_utils.cget_next_line.h
- Prototype of the function:
char *get_next_line(int fd);
. Wherefd
is the file descriptor to read from.
> gcc -Wall -Wextra -Werror -D BUFFER_SIZE=Nbr <files> main.c
> gcc -Wall -Wextra -Werror -D BUFFER_SIZE=Nbr <files_bonus> main.c
Nbr is the numbers of bytes that read function read each time.