Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zakariaelbouzkri/line_reader
This project is about programming a function that returns a line read from a file descriptor.
https://github.com/zakariaelbouzkri/line_reader
c file-des static-variables
Last synced: 3 days ago
JSON representation
This project is about programming a function that returns a line read from a file descriptor.
- Host: GitHub
- URL: https://github.com/zakariaelbouzkri/line_reader
- Owner: ZakariaElbouzkri
- Created: 2022-11-14T10:17:05.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-27T00:53:49.000Z (19 days ago)
- Last Synced: 2024-10-27T01:50:47.085Z (19 days ago)
- Topics: c, file-des, static-variables
- Language: C
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ 1337_get_neext_line
Reading a line on a fd is way too tedious
Usage
ยท
Testing---
## ๐ก 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.## ๐ ๏ธ 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"
```
OR:```C
#include "get_next_line_bonus.h"
```
For bonus part to from multiple file descriptors at the same time .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=
```### Returns
- Readed Line : correct beahviore
- NULL : if Nothing else to read or an error occured## ๐ 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 get_next_line.c get_next_line_utils.c -D BUFFER_SIZE=n && ./a.out
```Or you can also use this third party tester to fully test the project
* [Tripouille/gnlTester](https://github.com/Tripouille/gnlTester)
* [xicodomingues/francinette](https://github.com/xicodomingues/francinette)