The libft project is included in the 42 school program and entails the creation of a personal version of various standard C library functions. Its objective is to instruct on how to develop custom libraries that can be utilized in future projects.
To use the libft library, include the libft.h
header file in your project, and link your project against the libft.a
library file generated by the makefile. The library provides several functions to manipulate strings, characters, and memory.
The libft project requires the implementation of the following functions:
ft_memset
- fill a block of memory with a specific valueft_bzero
- zero out a block of memoryft_memcpy
- copy a block of memory from one location to anotherft_memccpy
- copy a block of memory from one location to another up to a specific characterft_memmove
- move a block of memory from one location to another, handling overlapsft_memchr
- search for a character in a block of memoryft_memcmp
- compare two blocks of memoryft_strlen
- get the length of a stringft_strlcpy
- copy a string to a specific sizeft_strlcat
- concatenate two strings to a specific sizeft_strchr
- search for a character in a stringft_strrchr
- search for a character in a string from the endft_strnstr
- search for a substring in a string up to a specific sizeft_strncmp
- compare two strings up to a specific sizeft_atoi
- convert a string to an integerft_isalpha
- check if a character is alphabeticft_isdigit
- check if a character is a digitft_isalnum
- check if a character is alphanumericft_isascii
- check if a character is a 7-bit ASCII characterft_isprint
- check if a character is printableft_toupper
- convert a character to uppercaseft_tolower
- convert a character to lowercase
The project also requires that you implement several additional functions:
ft_calloc
- allocate and zero out a block of memoryft_strdup
- duplicate a stringft_substr
- extract a substring from a stringft_strjoin
- concatenate two stringsft_strtrim
- remove leading and trailing whitespace from a stringft_split
- split a string into substrings based on a delimiterft_itoa
- convert an integer to a stringft_strmapi
- apply a function to each character in a string
The libft project also has several bonus requirements, including:
- Implement additional functions
- Implement linked lists
The libft project is an essential project for any programmer as it provides the foundation for manipulating strings, characters, and memory. By implementing your version of several standard C library functions, you will gain a deeper understanding of how these functions work and how you can customize them to suit your needs.