Custom C library that combines functions recoded in the following projects:
- Download and compile repo:
git clone https://github.com/khodizoda/42_mylib && cd 42_mylib
make
- Execute:
gcc libft.a libftprintf.a *.c
function | description |
---|---|
ft_count_begin_char | counts char c in the beginning of str |
ft_strlen | returns len of str |
ft_strnew | creates new str w/ malloc |
char_to_str | convert char to str |
ft_bzero | writes n zeroed bytes to str |
ft_strclr | sets every char in str to '\0' |
ft_strcpy | copies str src to dst |
ft_strncpy | copies at most n chars from src to dst |
ft_strcat | appends s2 to s1 |
ft_strncat | appends at most n chars from str2 to str1 |
ft_strlcat | appends src to dst, ensures NUL-termination of dst |
ft_strcmp | compares s1 and s2 |
ft_strncmp | compares at most n chars in s1 and s2 |
ft_strequ | lexicographically compares s1 and s2 |
ft_strnequ | lexicographically compares at most n chars in s1 and s2 |
ft_strchr | locates the first occurrence of char c in str |
ft_strrchr | locates the last occurrence of char c in str |
ft_strstr | locates the first occurrence of the str needle in the str haystack |
ft_strnstr | locates the first occurrence of the str needle in the str haystack, where at most n chars are searched |
ft_strdup | duplicates s1 w/malloc(3) |
ft_strsub | returns new str, where new str begins at a given index and is of size len |
ft_strjoin | returns new str, result of concatenation of s1 and s2 |
ft_strsubjoin | returns new str, result of concatenation of s1 and s2, where s2 starts at a given index |
ft_strsplit | returns array of strs by spliting str using a delimiter |
ft_strtrim | returns new str w/o whitespaces ' ' '\n' '\t at the beginning or at the end of the str |
free_n_copy | copies str using strsub, then frees it |
ft_striter | applies the f-n f to each char of the str |
ft_striteri | applies the f-n f to each char of the str and its index |
ft_strmap | applies the f-n f to each char of the str to create a new str w/malloc(3) |
ft_strmapi | applies the f-n f to each char of the str and its index to create a new str w/malloc(3) |
function | description |
---|---|
ft_isalnum | tests if ft_isalpha or ft_isdigit for a char is true |
ft_isalpha | tests if ft_toupper or ft_tolower for a char is true |
ft_isascii | tests if a given char is an ascii |
ft_isdigit | tests if a given char is a decimal digit |
ft_isprint | tests if a given char is a printing character |
ft_tolower | converts char to a lower-case letter |
ft_toupper | converts char to an upper-case letter |
function | description |
---|---|
ft_atoi | converts str to int |
ft_memalloc | allocates memory w/malloc(3) |
ft_strdel | frees str pointer w/ free(3) and sets it to NULL |
function | description |
---|---|
ft_absolute_val | converts to an absolute value |
ft_int_len | returns a len of an int |
ft_itoa | converts int to a str |
ft_itoa_unsigned | converts unsigned long int to a str |
ft_itoa_base_unsigned | converts unsigned long long int to str, given int base |
function | description |
---|---|
ft_memalloc | allocates memory w/malloc(3) |
ft_memset | writes len bytes of a char to the str |
ft_memcpy | copies at most n bytes from src to dst |
ft_memccpy | copies src to dst, if char c occurs in src, the copy stops |
ft_memmove | copies len bytes from src to dst |
ft_memchr | locates the first occurrence of char c in str s |
ft_memcmp | compares byte str s1 against byte str s2 |
ft_memdel | frees a memory address w/free(3) and sets it to NULL |
function | description |
---|---|
ft_putchar | outputs char to strout |
ft_putchar_fd | outputs char to fd |
ft_putnbr | outputs an int to stdout |
ft_putnbr_fd | outputs an int to fd |
ft_putstr | outputs str to stdout |
ft_putstr_fd | outputs str to fd |
ft_putstr_len | outputs str to stdout, given len |
ft_putendl | outputs str to stdout followed by a '\n' |
ft_putendl_fd | outputs str to fd followed by a '\n' |
function | description |
---|---|
ft_lstadd | adds a node to the beginning of a list |
ft_lstaddafter | adds a node after a given location in a list |
ft_lstaddend | adds a node to the end of a list |
ft_lstdel | deletes a linked list |
ft_lstdelbegin | deletes node from the beginning of a list |
ft_lstdelend | deletes a node from the end of a list |
ft_lstdelone | frees a node in a list |
ft_lstiter | iterates a list and applies a f-n f to each link |
ft_lstlen | returns len of a list |
ft_lstmap | iterates a list and applies a f-n f to each link to create a new list w/malloc(3) |
ft_lstnew | creates new linked liat |
function | description |
---|---|
ft_print_bits | takes a byte, and prints it in binary |
function | description |
---|---|
get_next_line | returns a line read from a fd, stdin, or redirection |
get_next_line_bonus | returns a line read from a fd, stdin, or redirection and supports reading from multiple fds |
function | description |
---|---|
ft_printf | outputs formatted str to stdout |