"We fell, but our arrows never missed."
get_next_line is a fundamental project in the 42 Porto common core curriculum. The objective is to create a C function capable of reading and returning one line at a time from a file descriptor.
The project focuses on efficient dynamic memory management, use of static variables to track progress between function calls, and careful data manipulation.
This project is especially important because the ability to read data from a file descriptor line by line is essential for various future projects at 42, whether reading from a file, stdin, or even later from a network connection.
| Function | Description |
|---|---|
| get_next_line | Reads and returns one line at a time from a file descriptor |
| get_next_line_utils | Contains auxiliary functions for the operation of get_next_line |
- Reading a predefined number of bytes (BUFFER_SIZE) until finding the end of a line
- Managing cases where the number of bytes in the line is not a multiple of BUFFER_SIZE
- Efficient dynamic memory manipulation (avoiding leaks)
- Using static variables to maintain state between function calls