"Get_Next_Line" is a project I completed at 42 School. The goal is to create a function that reads a line from a file descriptor, allowing efficient file input handling. This function helps manage dynamic memory and works with various file descriptors simultaneously.
https://github.com/rphlr/42-Subjects/blob/main/common-core/get_next_line/en.subject.pdf
- Read lines from a file descriptor
- Handle multiple file descriptors at once
- Efficient dynamic memory management
To clone and compile this project, follow these steps:
git clone https://github.com/your-username/Get_Next_Line.git
cd Get_Next_Line
make
Include the function in your projects:
#include "get_next_line.h"
Use the get_next_line function to read lines from a file:
int fd = open("file.txt", O_RDONLY);
char *line;
while (get_next_line(fd, &line) > 0) {
printf("%s\n", line);
free(line);
}
close(fd);