Skip to content

Implements a function that reads a file descriptor line by line. Focuses on dynamic memory allocation, buffer management, and persistent state handling across multiple function calls and file descriptors.

Notifications You must be signed in to change notification settings

Aztaban/get_next_line

Repository files navigation

get_next_line

πŸ“š Project Overview

get_next_line is a 42 school project where the goal is to create a function that reads a file descriptor line by line, returning one line each time it’s called β€” just like reading a file with fgets(), but with custom memory management and buffer handling.

πŸ”§ Function Prototype

char *get_next_line(int fd);
  • Returns the next line from a file descriptor
  • Includes the \n if present
  • Returns NULL on EOF or error
  • Bonus for multiple file descriptors included

βœ… Requirements

  • No memory leaks
  • One line per call
  • Handle multiple file descriptors (bonus)
  • Norm compliant

πŸ§ͺ Compilation Example

cc -Wall -Wextra -Werror get_next_line.c get_next_line_utils.c main.c

πŸ“ Files

  • get_next_line.c
  • get_next_line_utils.c
  • get_next_line.h

πŸ‘€ Author

Created and maintained by Martin Justa as part of the 42 school curriculum.

About

Implements a function that reads a file descriptor line by line. Focuses on dynamic memory allocation, buffer management, and persistent state handling across multiple function calls and file descriptors.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages