https://github.com/rogeriols/get_next_line-42sp
This projects is about creating a function that, allows to read a line ending with a newline character ('\n') from a file descriptor, without knowing its size beforehand.
https://github.com/rogeriols/get_next_line-42sp
42projects 42school c getnextline gnl
Last synced: 10 months ago
JSON representation
This projects is about creating a function that, allows to read a line ending with a newline character ('\n') from a file descriptor, without knowing its size beforehand.
- Host: GitHub
- URL: https://github.com/rogeriols/get_next_line-42sp
- Owner: RogerioLS
- License: mit
- Created: 2023-09-09T17:16:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-17T00:38:27.000Z (over 2 years ago)
- Last Synced: 2025-02-13T14:53:36.215Z (over 1 year ago)
- Topics: 42projects, 42school, c, getnextline, gnl
- Language: C
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# :clipboard: Get_Next_Line | 42 SP
[](https://github.com/RogerioLS/Get_Next_Line-42sp/actions/workflows/main.yml)










---

- Actual Status : finished.
- Result : Approved with 125 points by moulinette (the 42 tester) ✅
GNL is the second project at 42.
The aim of this project is to write a function that reads a file of buffer size specified by the user parameter and returns only one line each time the function is called.
There are two main challenges: handling varying buffer sizes and eliminating memory leaks.
## 📝 Functions
| Function | Description |
| :------: | :---------: |
| ``get_next_line.c`` | Contains the functions that compose the program logic, make with array.|
| ``get_next_line_utils`` | Contains the auxiliary functions. |
| ``get_next_line.h`` | The header with functions libraries and prototypes. |
| ``get_next_line_bonus.c`` | Contains the functions that compose the program logic, make with array.|
| ``get_next_line_utils_bonus`` | Contains the auxiliary functions. |
| ``get_next_line_bonus.h`` | The header with functions libraries and prototypes. |
## :star: Bonus
The same function but the challenge is dealing with multiple file descriptors!
## 🛠️ Usage
In order to use this function in your project, you must download this repository into your pc
``` shell
$> git clone https://github.com/RogerioLS/Get_Next_Line-42sp
```
Modify the path of the .txt file to one file of your preference in the main.
Compile with the command below (remember to replace "n" to the number of your preference):
``` shell
$> cc -Wall -Wextra -Werror -D BUFFER_SIZE=n get_next_line_bonus.c get_next_line_utils_bonus.c main.c
```