Libft is the first project at 42 programming school, and it consists on recreate some of the standard functions of the C language, in order to form our own library. The library can be used as a support in future school's projects, since it's not allowed to use the original functions. Once you finish the project, you can (and should) include more functions to Libft than previously asked.
ft_isalpha
- checks for an alphabetic characterft_isdigit
- checks for a digit (0 through 9).ft_isalnum
- checks for an alphanumeric characterft_isascii
- checks whether c fits into the ASCII character setft_isprint
- checks for any printable characterft_toupper
- converts char to uppercaseft_tolower
- converts char to lowercase
ft_memset
- fills memory with a constant byteft_strlen
- calculates the length of a stringft_bzero
- zeroes a byte stringft_memcpy
- copies memory areaft_memmove
- copies memory area without overlappingft_strlcpy
- copies string to a specific sizeft_strlcat
- concatenates string to a specific sizeft_strchr
- locates character in stringft_strrchr
- locates character in stringft_strncmp
- compares two stringsft_memchr
- scans memory for a characterft_memcmp
- compares memory areasft_strnstr
- locates a substring in a stringft_strdup
- creates a duplicate for the string passed as parameter
ft_atoi
- converts a string to an integerft_calloc
- allocates memory and sets its bytes' values to 0
ft_substr
- returns a substring from a stringft_strjoin
- concatenates two stringsft_strtrim
- trims the beginning and end of string with specific set of charsft_split
- splits a string using a char as parameterft_itoa
- converts a number into a stringft_strmapi
- applies a function to each character of a stringft_striteri
- applies a function to each character of a stringft_putchar_fd
- outputs a char to a file descriptorft_putstr_fd
- outputs a string to a file descriptorft_putendl_fd
- outputs a string to a file descriptor, followed by a new lineft_putnbr_fd
- outputs a number to a file descriptor
ft_lstnew
- creates a new list elementft_lstadd_front
- adds an element at the beginning of a listft_lstsize
- counts the number of elements in a listft_lstlast
- returns the last element of a listft_lstadd_back
- adds an element at the end of a listft_lstclear
- deletes and free listft_lstiter
- applies a function to each element of a listft_lstmap
- applies a function to each element of a list and returns a new list with the return of all nodes iteration
get_next_line
- reads any valid file line by line until the end (see the full project of get next line)ft_printf
- my version of printf functions fromstdio.h
(see the full project of ft_printf)
ft_lputaddress_fd
- outputs an address and returns its lengthft_lputbin_fd
- outputs a number in binary representation and returns its lengthft_lputdouble_fd
- outputs a double number and returns its lengthft_lputhexa_fd
- outputs a number in hexadecimal representation and returns its lengthft_lputnbr_fd
- outputs a integer and returns its lengthft_lputoctal_fd
- outputs a number in octal representation and returns its lengthft_lputstr_fd
- outputs a string and returns its lengthft_itoa_base
- converts a number in a string and applies the number system specifiedft_itoa_hex
- converts a number in a string and converts it to hexadecimal baseft_ptoa
- converts an address in a stringft_ctoa
- converts a single char in a string (char + '\0' termination)ft_check_string
- checks if a string is a null pointer and returns "(null)" if it is
First, clone this repository and cd
into it:
git clone https://github.com/mendes-jv/libft && cd libft
Compile the library with:
make
Now you have a file called libft.a
, use any function of the libft and compile your code with the archive.
[gcc | cc | clang] [flags] main.c libft.a && ./a.out