Fatih Çil

Self-Taught Developer

Software Engineer

Programmer

Game Developer

Fatih Çil

Self-Taught Developer

Software Engineer

Programmer

Game Developer

Blog Post

École 42: libft, get_next_line & ft_printf

February 20, 2022 École 42

Hi! After surviving the Piscine, the common core at École 42 starts with a trio of projects that all share one idea: you are not allowed to use the standard library — so build your own.

libft

The first project is rewriting a big part of the C standard library: memcpy, strlen, split, itoa, linked-list helpers and dozens more. It sounds mechanical, but it forces you to think about edge cases (what does strlcat really do when the buffer is too small?), undefined behaviour and memory ownership from day one. This library followed me through the whole cursus — almost every later project links against it.

get_next_line

A function that returns a file one line at a time, no matter the buffer size. The real lesson here is static variables and state management: handling leftovers between calls, multiple file descriptors at once, and making it leak-free with every possible read size. Debugging it with BUFFER_SIZE=1 and BUFFER_SIZE=10000000 teaches you respect for boundary conditions.

ft_printf

Reimplementing printf with variadic functions: parsing format strings, handling conversions (%d, %s, %x, %p…) and getting the return value exactly right. It is the first project where you design a small architecture — a dispatcher, converters, a buffer — instead of writing isolated functions.

Together these three gave me the C toolbox I used for the next two years. You can find them in my 42Cursus repository.

42 libft badge

Related Posts