This project is about coding a C library.
It contains a lot of general-purpose functions other programs rely upon.
Number | Name | Explanation |
---|---|---|
1 | isalpha | Checks whether a character is an alphabet. |
2 | isdigit | Checks whether a character is a numeric character (0-9) or not. |
3 | isalnum | Checks, whether the argument passed, is an alphanumeric character (alphabet or number) or not. |
4 | isascii | Tests if a given character, in the current locale, can be represented as a valid 7–bit US-ASCII character. |
5 | isprint | Checks whether a character is a printable character. |
6 | strlen | Calculates the length of a given string. |
7 | memset | Fill a memory block with a particular value. |
8 | bzero | Places n zero-valued bytes in the area pointed to by s. |
9 | memcpy | Copies n characters from memory area src to memory area dest. |
10 | memmove | Copies n characters from str2 to str1, but for overlapping memory blocks, memmove() is a safer approach than memcpy(). |
11 | strlcpy | Copies characters from src to dest and null-terminate the resulting string. |
12 | strlcat | Concatenates characters from src to dest and null-terminate the resulting string. |
13 | toupper | Converts a lowercase alphabet to an uppercase alphabet. |
14 | tolower | Takes an uppercase alphabet and converts it to a lowercase character. |
15 | strchr | Searches for the first occurrence of the character c (an unsigned char) in the string pointed to by the argument str. |
16 | strrchr | Searches for the last occurrence of the character c (an unsigned char) in the string pointed to, by the argument str. |
17 | strncmp | Compares at most the first n bytes of str1 and str2. |
18 | memchr | Searches for the first occurrence of the character c (an unsigned char) in the first n bytes of the string pointed to, by the argument str. |
19 | memcmp | Compares the first n bytes of memory area str1 and memory area str2. |
20 | strnstr | Locates the first occurrence of the null-terminated string little in the string big, where not more than len characters are searched. |
21 | atoi | Converts the string argument str to an integer (type int). |
22 | calloc | Allocates the requested memory and returns a pointer to it. The difference between malloc and calloc is that malloc does not set the memory to zero whereas calloc sets allocated memory to zero. |
23 | strdup | Returns a pointer to a null-terminated byte string, which is a duplicate of the string pointed to by s. The memory obtained is done dynamically using malloc; hence, it can be freed using free(). |
24 | ft_substr | Allocates (with malloc(3)) and returns a substring from the string ’s’. The substring begins at index ’start’ and is of maximum size ’len’. |
25 | ft_strjoin | Allocates (with malloc(3)) and returns a new string, which is the result of the concatenation of ’s1’ and ’s2’. |
26 | ft_strtrim | Allocates (with malloc(3)) and returns a copy of ’s1’ with the characters specified in ’set’ removed from the beginning and the end of the string. |
27 | ft_split | Allocates (with malloc(3)) and returns an array of strings obtained by splitting ’s’ using the character ’c’ as a delimiter. The array must end with a NULL pointer. |
28 | ft_itoa | Allocates (with malloc(3)) and returns a string representing the integer received as an argument. Negative numbers must be handled. |
29 | ft_strmapi | Applies the function ’f’ to each character of the string ’s’, and passing its index as the first argument to create a new string (with malloc(3)) resulting from successive applications of ’f’. |
30 | ft_striteri | Applies the function ’f’ on each character of the string passed as an argument, passing its index as the first argument. Each character is passed by address to ’f’ to be modified if necessary. |
31 | ft_putchar_fd | Outputs the character ’c’ to the given file descriptor. |
32 | ft_putstr_fd | Outputs the string ’s’ to the given file descriptor. |
33 | ft_putendl_fd | Outputs the string ’s’ to the given file descriptor followed by a newline. |
34 | ft_putnbr_fd | Outputs the integer ’n’ to the given file descriptor. |
35 | ft_lstnew | Allocates (with malloc(3)) and returns a new node. The member variable ’content’ is initialized with the value of the parameter ’content’. The variable ’next’ is initialized to NULL. |
36 | ft_lstadd_front | Adds the node ’new’ at the beginning of the list. |
37 | ft_lstsize | Counts the number of nodes in a list. |
38 | ft_lstlast | Returns the last node of the list. |
39 | ft_lstadd_back | Adds the node ’new’ at the end of the list. |
40 | ft_lstdelone | Takes as a parameter a node and frees the memory of the node’s content using the function ’del’ given as a parameter and free the node. The memory of ’next’ must not be freed. |
41 | ft_lstclear | Deletes and frees the given node and every successor of that node, using the function ’del’ and free(3). Finally, the pointer to the list must be set to NULL. |
42 | ft_lstiter | Iterates the list ’lst’ and applies the function ’f’ on the content of each node. |
43 | ft_lstmap | Iterates the list ’lst’ and applies the function ’f’ on the content of each node. Creates a new list resulting of the successive applications of the function ’f’. The ’del’ function is used to delete the content of a node if needed. |