← Back to projects

libft

A personal C library reimplementing part of the standard library, linked by every later 42 project.

Period
12/12/2021
Category
42
Area
Systems
Grade
125
Stack
  • C
  • Makefile
Links

My first project at 42: rebuilding a chunk of the C standard library, plus a set of utility functions reused by everything that came after.

What it contains

  • Standard library functions rewritten from their man pages and prefixed ft_: strlen, memcpy, memmove, strlcpy, strnstr, atoi, and the is* character tests.
  • Functions the standard library does not provide, or provides differently: substr, strjoin, strtrim, split, itoa, strmapi, striteri, and the putchar_fd family.
  • A bonus set for singly linked lists: lstnew, lstadd_front, lstadd_back, lstsize, lstlast, lstdelone, lstclear, lstiter, lstmap.

What it taught me

Reading a man page as a specification and matching it exactly, return values and edge cases included. Everything compiles into libft.a and gets linked by the later projects, so a bug written here surfaces months later, in code that has nothing to do with it.