42 Bangkok · Project notes

get_next_line

A line-by-line reader for file descriptors, designed around buffered input.

What I Did

Implemented a function that returns one line at a time while retaining unread data between calls.

What I Learned

  • Managing persistent state
  • Working with buffers
  • Handling file descriptors and edge cases

Key concepts

CFile descriptorsStatic storageBufferingMemory management