Objetivo deste projeto é codificar uma biblioteca C reagrupando funções usuais que poderemos usar em todos os outros projetos da 42.
Objective of this project is to code a C library regrouping usual functions that we will be able to use in all 42 other projects.
A maior parte está na biblioteca C (veja man). Outros não estão na biblioteca C, mas será muito útil ainda mais. Estas funções estão descritas no assunto.
The most part is in C library (see man). Others are'nt in the C library but it will be so usefull further. This functions are described in subject.
- Imperative programming
- Rigor
- Algorithms & AI
🚧 project:
Libft42 $ make
🚿 Clean Obj files:
Libft42 $ make clean
🚿 🚿 Clean All (obj files + binary):
Libft42 $ make fclean
🚿 🚿 🚧 Clean All + build:
Libft42 $ make re
See Makefile
C Library ctype.h | |||
Libft | Description | ||
ft_isalnum | Checks if the character passed is alphanumeric. | ||
ft_isalpha | Checks if the character passed is alphabetic. | ||
ft_isascii | Checks if the character passed is ASCII. | ||
ft_digit | Checks if the character passed is decimal digit. | ||
ft_isprint | Checks if the character passed is printable, including space. | ||
ft_tolower | Converts uppercase letters to lowercase. | ||
ft_toupper | Converts lowercase letters to uppercase. | ||
C Library Sting.h | |||
ft_bzero | Resets the dynamic memory region replacing whatever is there by null to clear it of junk values. | ||
ft_memchr | Looks for the first occurrence of the character c (an unsigned character) in the first n bytes of the pointed string, by the str argument. | ||
ft_memcmp | Compares the first n bytes of memory area str1 and memory area str2. | ||
ft_memcpy | assign each character of src pointer to dest pointer as counter is less than the size, and returns the dest pointer. | ||
ft_memmove | Copy bytes of length from buffer pointed to by src to buffer pointed to by std. Copying overlapping regions is handled safely. | ||
ft_memset | Fills length bytes starting at dst with the value C. | ||
ft_strchr | finds the first occurrence of C (converted to a char) in the string pointed to by S. | ||
ft_strlcat | appends the NULL terminated string src to the end of dst. | ||
ft_strlcpy | Copy up to length 1 character from NULL terminated string src to dst, ending in NULL the result. | ||
ft_strlen | Counts how many characters there are while the parameter passed is not null. | ||
ft_strncmp | Compares at most the first n bytes of str1 and str2. | ||
ft_strnstr | Finds the first occurrence of the null term string nated s2 in string s1, where no more than n characters are searched. | ||
ft_strrchr | look for the last occurrence of the character c (an unsigned character) in the string pointed to by the str argument | ||
C Library Stdlib.h | |||
ft_atoi | converts the initial portion of the string pointed to by nptr to int. Atoi() does not detect errors | ||
ft_calloc | allocates memory for an array of nmemb elements of size each and returns a pointer to the allocated memory. | ||
Non-stantard C Library | |||
ft_itoa | Converts the int to a string (type char *). | ||
ft_putchar_fd | Displays the 'c' character for the given file descriptor. | ||
ft_putendl_fd | Displays the string 's' for the given file descriptor, followed by a newline. | ||
ft_putnbr_fd | Display the integer 'n' for the given file descriptor. | ||
ft_putstr_fd | Display the string 's' for the given descriptor file. | ||
ft_strdup | Returns a pointer to a new string that is a duplicate of string s. | ||
ft_strjoin | returns a newstring, which is the result of concatenating 's1' and 's2'. | ||
ft_strmapi | Apply the 'f' function to each character of the string 's' to create a new string. | ||
ft_strtrim | returns a copy of 's1' with the characters specified in 'set' removed from beginning and end of string. | ||
ft_substr | Returns a substring of the string 's'. The substring starts at index 'start' and is of maximum length 'len'. | ||
Chained lists manipulation | |||
ft_lstadd_back | Adds the element at the end of the list. | ||
ft_lstadd_front | Adds the element at the beginning of the list. | ||
ft_lstclear | Deletes and frees the given element and every successor of that element, using a given function and free. | ||
ft_lstdelone | Takes as a parameter an element and frees the memory of the element’s content using a function given as a parameter and free the element. | ||
ft_lstiter | Iterates the list and applies a function to the content of each element. | ||
ft_lstlast | Returns the last element of the list. | ||
ft_lstmap | Iterates the list and applies a function to the content of each element. Creates a new list resulting of the successive applications of the function. A 'del' function is used to delete the content of an element if needed. | ||
ft_lstnew | Returns a new element. | ||
ft_lstsize | Counts the number of elements in a list. |