This project aims to redo a library of some functions in C that can be used in the next projects of Codam.
Compilation & Usage To compile the library, you can use the following commands:
- make or make all - Compiles the library.
- make clean - Removes the object files generated during compilation.
- make fclean - Removes the compiled library and the object files.
- make re - Performs a clean recompilation of the library.
- make bonus - Compiles the library including the bonus part.
The Makefile uses the following compilation flags:
- -Wall -Wextra -Werror - Enables additional warnings and treats warnings as errors.
- -I. - Specifies the include directory for header files.
int ft_isalpha(int c);
- Check if a character is an alphabetic character.int ft_isdigit(int c);
- Check if a character is a digit.int ft_isalnum(int c);
- Check if a character is alphanumeric.int ft_isascii(int c);
- Check if a character is within the ASCII range.int ft_isprint(int c);
- Check if a character is printable.int ft_toupper(int c);
- Convert a lowercase character to uppercase.int ft_tolower(int c);
- Convert an uppercase character to lowercase.
size_t ft_strlen(const char *s);
- Calculate the length of a string.size_t ft_strlcpy(char *dst, const char *src, size_t dstsize);
- Copy a string from src to dst with size limiting.size_t ft_strlcat(char *dst, const char *src, size_t dstsize);
- Concatenate two strings with size limiting.char *ft_strchr(const char *s, int c);
- Locate the first occurrence of a character in a string.char *ft_strrchr(const char *s, int c);
- Locate the last occurrence of a character in a string.int ft_strncmp(const char *str1, const char *str2, size_t n);
- Compare two strings up to a specified number of characters.char *ft_strnstr(const char *haystack, const char *needle, size_t len);
- Locate a substring within a string, limited to a certain length.char *ft_strdup(const char *s1);
- Duplicate a string.char *ft_substr(char const *s, unsigned int start, size_t len);
- Extract a substring from a string.
void *ft_memset(void *b, int c, size_t len);
- Fill a block of memory with a specific byte value.void ft_bzero(void *s, size_t n);
- Set the first n bytes of memory to zero.void *ft_memcpy(void *dst, const void *src, size_t n);
- Copy n bytes from src to dst.void *ft_memmove(void *dst, const void *src, size_t len);
- Copy len bytes from src to dst, handling overlapping memory regions.void *ft_memchr(const void *s, int c, size_t n);
- Locate the first occurrence of a byte in a memory block.int ft_memcmp(const void *s1, const void *s2, size_t n);
- Compare two memory blocks up to a specified number of bytes.int ft_atoi(const char *str);
- Convert a string to an integer.void *ft_calloc(size_t count, size_t size);
- Allocate and zero-initialize memory.char *ft_strjoin(char const *s1, char const *s2);
- Concatenate two strings.char *ft_strtrim(char const *s1, char const *set);
- Trim specified characters from the beginning and end of a string.char **ft_split(char const *s, char c);
- Split a string into an array of substrings based on a delimiter character.char *ft_itoa(int n);
- Convert an integer to a string.char *ft_strmapi(char const *s, char (*f)(unsigned int, char));
- Apply a function to each character of a string, creating a new string.void ft_striteri(char *s, void (*f)(unsigned int, char*));
- Apply a function to each character of a string with its index.void ft_putchar_fd(char c, int fd);
- Write a character to a file descriptor.void ft_putstr_fd(char *s, int fd);
- Write a string to a file descriptor.void ft_putendl_fd(char *s, int fd);
- Write a string followed by a newline to a file descriptor.void ft_putnbr_fd(int n, int fd);
- Write an integer to a file descriptor.
t_list *ft_lstnew(void *content);
- Create a new linked list node.void ft_lstadd_front(t_list **lst, t_list *new);
- Add a new node to the beginning of a linked list.int ft_lstsize(t_list *lst);
- Count the number of elements in a linked list.t_list *ft_lstlast(t_list *lst);
- Get the last node of a linked list.void ft_lstadd_back(t_list **lst, t_list *new);
- Add a new node to the end of a linked list.void ft_lstdelone(t_list *lst, void (*del)(void *));
- Delete a node from a linked list, freeing its memory.void ft_lstclear(t_list **lst, void (*del)(void *content));
- Delete all nodes from a linked list, freeing their memory.void ft_lstiter(t_list *lst, void (*f)(void *));
- Apply a function to each node of a linked list.t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *));
- Apply a function to each node of a linked list, creating a new list based on the results.