Skip to content

About

πŸ“œ A function that returns an allocated pointer to a line every time a next line is found until EOF :D

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

Β 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 

Repository files navigation

GetNextLine

A function that allocates a line every time a next line is found until EOF :D

βœ… usage

Include the header in your program and then call like:

char	*line;
int	fd = open("somerandomfile.txt", "r");

while (get_next_line(fd, &line) > 0) {
  printf("%s\n", line);
  free(line);
  }

❗ note

  • get_next_line returns the amount of bytes read unless eof is reached in which case it returns 0 or an error occurred then -1 is returned

πŸ’€ code

prototype

int get_next_line(int fd, char **line);

About

πŸ“œ A function that returns an allocated pointer to a line every time a next line is found until EOF :D

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages