Skip to content

ruiribeiro04/42_get_next_line

Repository files navigation

Get Next Line - 42 Porto

42 Porto Language

"We fell, but our arrows never missed."

About the project

get_next_line is a fundamental project in the 42 Porto common core curriculum. The objective is to create a C function capable of reading and returning one line at a time from a file descriptor.

The project focuses on efficient dynamic memory management, use of static variables to track progress between function calls, and careful data manipulation.

This project is especially important because the ability to read data from a file descriptor line by line is essential for various future projects at 42, whether reading from a file, stdin, or even later from a network connection.

Implemented Features

Mandatory Part

Function Description
get_next_line Reads and returns one line at a time from a file descriptor
get_next_line_utils Contains auxiliary functions for the operation of get_next_line

Technical Challenges

  • Reading a predefined number of bytes (BUFFER_SIZE) until finding the end of a line
  • Managing cases where the number of bytes in the line is not a multiple of BUFFER_SIZE
  • Efficient dynamic memory manipulation (avoiding leaks)
  • Using static variables to maintain state between function calls

About

get_next_line: Reads and returns the next line from a file descriptor, supporting multiple descriptors (bonus files). Essential for file reading in C.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages