In this repo you will find all the codes developed during the get_next_line 1337's project, both mandatory's part and bonus part.
Calling the function get_next_line in a loop will then allow you to read the text available on the file descriptor one line at a time until the end of it. The function should return the line that has just been read. If there is nothing else to read or if an error has occurred it should return NULL.
To succeed get_next_line with a single static variable. To be able to manage multiple file descriptors with your get_next_line. For example, if the file descriptors 3, 4 and 5 are accessible for reading, then you can call get_next_line once on 3, once on 4, once again on 3 then once on 5 etc. without losing the reading thread on each of the descriptors
MANDATORY ALGORITHM :
GET_NEXT_LINE
DESCRIPTION :
Write a function which returns a line read from a
file descriptor.
RETURN VALUES :
Read line: correct behavior.
NULL: nothing else to read or an error occurred.
get_next_line
requires gcc compiler and some standard libraries.
Clone this repository in your local computer:
git clone https://github.com/pix3l-p33p3r/get_next_line.git
To use the library in your code you will need to include the header:
#include "get_next_line.h"
or
#include "get_next_line_bonus.h"
To compile the program, use these flags:
Make sure to change the XX after BUFFER_SIZE to the buffer size you want the program to work with.
gcc -Wall -Wextra -Werror -D BUFFER_SIZE=XX path/to/main_function.c path/to/get_next_line.c path/to/get_next_line_utils.c -I path/to/get_next_line.h