get_next_line

by bhagenlo

written for version 10

Hello again. Glad you're here.
Image originally from Leftover Salad
True to this spirit, this project finally arrives at the heart of C Programming: Allocating memory.
It's not much code you have to write, but also not that easy to get it right. Especially when freeing.

#Prerequisites

So. Before starting your work at get_next_line(), you should know:

  • How to assign a static variable (and how it works)
  • How to properly ft_calloc() a pointer
  • How to properly free it
  • What a buffer is

#During

While working on your get_next_line(), you'll need to get to know:

  • read() and how it works

#Cleaning Up

Well, if your program is working – and I'm sure you tested it thoroughly, with a checker and for yourself, everything should be fine.
Except for:

  • Did you include your *_bonus.h header file in your bonus files?

#Aftercare

You made it through? Nice!

Well, there's not so much to do here:

  • Write a small program that actually uses get_next_line(). How about something you can pipe input into, and which then returns it line by line?

    λ echo "Hello, it's me." | ./your_echo
    Hello, it's me.
    λ

Nice, up to greater quests!

And may your memory always be freed.

#Pointers

The Manpage for read().

← ft_printf

Found something to improve? Edit this page on Github!

push_swap →