https://github.com/hunam6/get_next_line
Indispensable utility to read a file - Hive Helsinki (42 school)
https://github.com/hunam6/get_next_line
42 42projects get-next-line getnextline hive hivehelsinki
Last synced: over 1 year ago
JSON representation
Indispensable utility to read a file - Hive Helsinki (42 school)
- Host: GitHub
- URL: https://github.com/hunam6/get_next_line
- Owner: Hunam6
- License: mit
- Created: 2022-12-13T10:00:23.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-23T15:19:28.000Z (over 3 years ago)
- Last Synced: 2025-01-23T14:17:04.177Z (over 1 year ago)
- Topics: 42, 42projects, get-next-line, getnextline, hive, hivehelsinki
- Language: C
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
get_next_line
Indispensable utility to read a file
## 🛠️ Installation
Compile your project with `get_next_line.c` and `get_next_line_utils.c`.
Include `get_next_line.h` in your file.
## 📚 Usage
```c
#include
#include
#include "get_next_line.h"
int main(int ac, char **av)
{
int fd;
if (ac != 2)
return(printf("Usage: ./gnl \n"));
if ((fd = open(av[1], O_RDONLY)) == -1)
return (printf("Failed to open the file.\n"));
while (42)
{
char *line = get_next_line(fd);
if (!line)
break;
printf("%s", line);
}
if (close(fd) == -1)
return (printf("Failed to close the file.\n"));
}
```