This project creates a library with standard libc functions and several other generic functions, which will be used for other 42 projects.
The purpose is not to reinvent the wheels, but to help us develop a deep understanding of the standard libc functions and how to use them.
- Allowed functions:
malloc
,free
,write
- All heap allocated memory space must be properly freed when necessary
libc functionss
- ft_bzero
- ft_calloc
- ft_isalnum
- ft_isalpha
- ft_isascii
- ft_isdigit
- ft_isprint
- ft_itoa
- ft_memccpy
- ft_memchr
- ft_memcmp
- ft_memcpy
- ft_memmove
- ft_memset
- ft_putchar_fd
- ft_putendl_fd
- ft_putnbr_fd
- ft_tolower
- ft_toupper
string manipulation
- ft_atoi
- ft_putstr_fd
- ft_split
- ft_strchr
- ft_strdup
- ft_strjoin
- ft_strlcat
- ft_strlcpy
- ft_strlen
- ft_strmapi
- ft_strncmp
- ft_strnstr
- ft_strncmp
- ft_strrchr
- ft_strtrim
- ft_substr
linked list manipulation
To test the library, create a
test.c
file to compile with thelibft.a
library
# include "libft.h"
# include <stdio.h>
int main(void)
{
char *str;
int ret;
str = "123456789";
ret = ft_atoi(str);
printf("ret is %d\n", ret);
return (0);
}
Run the commands below. You can replace the
test.c
with your own test file
$ git clone https://github.com/qingqingqingli/libft.git
$ cd libft
$ make
$ make bonus
$ gcc test.c libft.a
$ ./a.out