An open API service indexing awesome lists of open source software.

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)

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"));
}
```