get_next_line is a 42 Madrid Common Core project in which you have to code a function that will return a line read from a file descriptor.
In this project you will have to code a function that when used in a loop will read and return all the lines from a file using its file descriptor.
- Function protoype:
char *get_next_line(int fd);
- Your function must return the line read,
NULL
if reaches the end of file or returns error. - Your function have to work with files and with
stdin
. - Every line read from your function must end with the
\n
null char, except at the end of the file if it does not end with it. - The script must have a static variable
BUFFER_SIZE
to set the default buffer size. - The project must compile with the
-D BUFFER_SIZE=XX
flag but should have to compile without it.
- The use of the
libft
library is forbidden. - The use of
lseek
is forbidden. - The use of global variables is forbidden.
- C compiler:
gcc
,cc
, etc...
-
Clone the repository:
git clone https://github.com/RaulSoftDev/get_next_line.git
-
Use the function in your project:
#include "get_next_line/get_next_line.h"
-
Compile your project:
gcc -Wall -Wextra -Werror -D BUFFER_SIZE=42 *.c