This project has been created as part of the 42 curriculum by bpavlows
The Libft project is the first milestone of the 42 school curriculum. The objective is to create a personal C library by re-coding standard C functions and adding useful utility functions. This library serves as a foundational tool for almost all subsequent C projects at 42.
Developing this library provides a deep understanding of:
- Memory management (using
malloc,free, andmemset). - String manipulation in C.
- Linked lists and basic data structures.
Standard functions from <ctype.h>, <string.h>, and <stdlib.h>:
- Character Checks:
ft_isalpha,ft_isdigit,ft_isalnum,ft_isascii,ft_isprint. - String Manipulation:
ft_strlen,ft_strlcpy,ft_strlcat,ft_strchr,ft_strrchr,ft_strncmp,ft_strnstr. - Memory Handling:
ft_memset,ft_bzero,ft_memcpy,ft_memmove,ft_memchr,ft_memcmp. - Conversions:
ft_toupper,ft_tolower,ft_atoi. - Allocation:
ft_calloc,ft_strdup.
Functions not found in the standard library or implemented differently:
ft_substr: Extracts a substring from a string.ft_strjoin: Concatenates two strings into a new memory allocation.ft_strtrim: Trims specific characters from the beginning and end of a string.ft_split: Splits a string into an array of strings based on a delimiter.ft_itoa: Converts an integer to a string.ft_strmapi/ft_striteri: Applies a function to each character of a string.ft_putchar_fd/ft_putstr_fd/ft_putendl_fd/ft_putnbr_fd: Output functions using file descriptors.
Functions to manipulate a t_list structure, including creating nodes, adding/removing elements, and clearing lists.
This project uses a Makefile to automate the compilation process.
To compile the library and generate the libft.a file:
makeOther Commands
make clean: Removes all object files (.o).
make fclean: Removes object files and the compiled library (libft.a).
make re: Performs a fclean followed by a make.
Usage
To use this library in your project, include the header:
#include "libft.h"And link it during compilation:
cc main.c -L. -lft