Skip to content

yakuseishou/libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 

Repository files navigation

libft

Create my own implentation of C standard libray function

Part 1.
/* string */

ft_memset -

void     *ft_memset(void *str, int c, size_t n);

           Writes n bytes of value c (converted to an unsigned char) to the string b.
Example: ft_memset("Hello World!\n", '#', 4) -> "####o World!\n"

ft_memcpy -

void	*ft_memcpy(void *s1, const void *s2, size_t n);

           Copies n bytes from memory area of s2 to s1.
Example: s1[30] = "word" , ft_memset(s1, "Hello World!\n", 13) -> "Hello World!\n"

ft_memccpy -

void    *ft_memccpy(void *dest, const void *src, int c, size_t n);

           Copies n bytes from src to dest. If c occurs in src, copy stops and point to
the byte after c in dest is returned. Otherwise, n bytes are copied and null
pointer is returned.

ft_memchr -

void	*ft_memchr(const void *str, int c, size_t n);

            Locates the first occurrence of c in string s.
Example: ft_memchr("Hello World", o, 11) -> "o World"

ft_memmove -

void	*ft_memmove(void *s1, const void *s2, size_t n);

           Copies n bytes from s2 to s1. The two strings may overlap;
the copy is always done in a non-destructive manner

ft_memcmp -

int	ft_memcmp(const void *str1, const void *str2, size_t n);

           Returns zero if the two strings are identical,
otherwise returns the difference between the first two differing bytes.
0 length are identical.

ft_strlen -

size_t	ft_strlen(const char *str);

           Returns the length of a string
Example: ft_strlen("hello world") -> 11;

ft_strdup -

char	*ft_strdup(const char *src);

           Allocates sufficient memory for the string, copies it, and return it.

ft_strcpy -

char	*ft_strcpy(char *s1, const char *s2);

           Copies s2 to s1 including '\0'

ft_strncpy -

char	*ft_strncpy(char *dest, const char *src, unsigned int n);

           Copy at most n char from src into dest.  If src is less than n char long,
the remainder of dest is filled with `\0' char. Otherwise, dest is not terminated.

ft_strcat -

char	*ft_strcat(char *dest, char *src);

           Append a copy of src to the end of dest, then add a '\0'.  The string dest
must have sufficient space to hold the result.

ft_strncat -

char	*ft_strncat(char *dest, char *src, int n);

           Appends not more than n characters from src to dest, and then adds a '\0'.
The string dest must have sufficient space to hold the result.

ft_strlcat -

size_t	ft_strlcat(char *dst, const char *src, size_t n);


ft_strchr -

char	*ft_strchr(const char *str, int c);


ft_strrchr -

char	*ft_strrchr(const char *str, int c);


ft_strstr -

char	*ft_strstr(const char *str, const char *to_find);


ft_strnstr -

char	*ft_strnstr(const char *b, const char *s, size_t n);


ft_strcmp -

int	ft_strcmp(const char *s1, const char *s2);


ft_strncmp - int ft_strncmp(const char *s1, const char *s2, size_t n);


/* strings */

ft_bzero -

/* stdlib */

ft_atoi -

/* ctype */

ft_isalpha - ft_isdigit - ft_isalnum - ft_isascii - ft_isprint - ft_toupper - ft_tolower -

Part 2.

ft_memalloc ft_memdel ft_strnew ft_strdel ft_strclr ft_striter ft_striteri ft_strmap ft_strmapi ft_strequ ft_strnequ ft_strsub ft_strjoin ft_strtrim ft_strsplit ft_itoa

/* output */

ft_putchar ft_putstr ft_putendl ft_putnbr ft_putchar_fd ft_putstr_fd ft_putendl_fd ft_putnbr_fd

Bounus.

ft_lstnew ft_lstdelone ft_lstdel ft_lstadd ft_lstiter ft_lstmap

About

create libft function with c

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published