get_next_line is a project at 42 that basically reads a file line by line. This project is frequently used in further projects.
But the goal here is to be able to do it by using any functions from my libft and only the standard functions read, malloc and free.
I added a main file called main.c, it takes a file name as an argument, opens it and passes the file descriptor (fd) to get_next_line until get_next_line returns -1 or 0. Also I added main2.c, it takes two file names as an arguments, to show usage of multiple descriptors.
git clone https://github.com/AnneMedvedeva/get_next_line_42.git
cd get_next_line
make -C libft/
gcc -Wall -Wextra -Werror -I./libft/includes/ -L./libft -lft -o gnl_1 get_next_line.c main.c
gcc -Wall -Wextra -Werror -I./libft/includes/ -L./libft -lft -o gnl_2 get_next_line.c main2.c
You can change main files at the end or write your own.
./gnl_1 test_1.txt
./gnl_2 test_1.txt text_2.txt