The second project on the 42sp fundamentals track, Get Next Line, is based on the creation of a function that returns line by line from a file pointed to by a file descriptor, covering topics such as reading and describing files, static variables, dynamic allocation memory, pointers, and more.
get_next_line.c
get_next_line_bonus.c
- main functions (project implementation)get_next_line.h
get_next_line_bonus.h
- header file (prototypes and includes)get_next_line_utils.c
get_next_line_utils_bonus.c
- auxiliary functions (project requirements)
- Make sure you clone the repository with the following command:
$> git clone [email protected]:ArthurSobreira/42_get_next_line.git
- Once cloned, compile the program with the following command (the value of BUFFER_SIZE can be changed if you prefer):
$> cc -Wall -Wextra -Werror -D BUFFER_SIZE=42 main.c src/get_next_line.c utils/get_next_line_utils.c include/get_next_line.h && ./a.out
- Running the binary, the result should look something like this:
Line 1 -> ██╗░░██╗███████╗██╗░░░░░██╗░░░░░░█████╗░ ░██╗░░░░░░░██╗░█████╗░██████╗░██╗░░░░░██████╗░
Line 2 -> ██║░░██║██╔════╝██║░░░░░██║░░░░░██╔══██╗ ░██║░░██╗░░██║██╔══██╗██╔══██╗██║░░░░░██╔══██╗
Line 3 -> ███████║█████╗░░██║░░░░░██║░░░░░██║░░██║ ░╚██╗████╗██╔╝██║░░██║██████╔╝██║░░░░░██║░░██║
Line 4 -> ██╔══██║██╔══╝░░██║░░░░░██║░░░░░██║░░██║ ░░████╔═████║░██║░░██║██╔══██╗██║░░░░░██║░░██║
Line 5 -> ██║░░██║███████╗███████╗███████╗╚█████╔╝ ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░░██║███████╗██████╔╝
Line 6 -> ╚═╝░░╚═╝╚══════╝╚══════╝╚══════╝░╚════╝░ ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚═╝╚══════╝╚═════╝░