https://github.com/simon-zerisenay/42_get_next_line
Get next line is a function that takes one argument which is file descriptor and return the first line of a given file. Detailed explanation can be found in readme
https://github.com/simon-zerisenay/42_get_next_line
42 42abudhabi 42get-next-line 42school cursus ecole42 getnextline
Last synced: 7 months ago
JSON representation
Get next line is a function that takes one argument which is file descriptor and return the first line of a given file. Detailed explanation can be found in readme
- Host: GitHub
- URL: https://github.com/simon-zerisenay/42_get_next_line
- Owner: simon-zerisenay
- Created: 2023-02-07T20:55:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-10T16:11:49.000Z (over 2 years ago)
- Last Synced: 2025-01-15T20:46:03.798Z (9 months ago)
- Topics: 42, 42abudhabi, 42get-next-line, 42school, cursus, ecole42, getnextline
- Language: C
- Homepage:
- Size: 97.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
๐ get_next_line
Reading a line on a fd is way too tedious
![]()
![]()
![]()
![]()
![]()
About
ยท
Usage
ยท
Testing---
Score
![]()
## ๐ก About the project
> _The aim of this project is to make you code a function that returns a line, read from a file descriptor._
You will understand how files are opened, read and closed in an OS,
and how they are interpreted by a programming language for further analysis.
This task is crucial to understand for a future programmer since much of the time is based
on manipulating files for data management and persistence.
This project consists of coding a function that returns one line at a time from a text file.For more detailed information, look at the [**subject of this project**](https://github.com/jdecorte-be/42-Get-next-line/blob/master/en.subject.pdf).
## ๐ ๏ธ Usage
### Requirements
The function is written in C language and thus needs the **`gcc` compiler** and some standard **C libraries** to run.
### Instructions
**1. Using it in your code**
To use the function in your code, simply include its header:
```C
#include "get_next_line.h"
```and, when compiling your code, add the source files and the required flag:
```shell
get_next_line.c get_next_line_utils.c -D BUFFER_SIZE=
```## ๐ Testing
You only have to edit the get_next_line.c file and uncomment the main function and headers inside it.
You can edit test.txt files to put another text if you wish to test othe cases.
Then simply run this command (change "xx" with desired buffer size) :```shell
gcc -Wall -Werror -Wextra -D BUFFER_SIZE=xx get_next_line.c get_next_line_utils.c && ./a.out
```
and
```shell
gcc -Wall -Werror -Wextra -D BUFFER_SIZE=xx get_next_line_bonus.c get_next_line_utils_bonus.c && ./a.out``` for the bonus part.
Or you can also use this third party tester to fully test the project
* [Tripouille/gnlTester](https://github.com/Tripouille/gnlTester)
In addition to that you can use valgrind 42. The link can be found here.
* (https://github.com/opsec-infosec/42-ValgrindContainer)