School 42 Málaga cursus project
This repository contains all archives for the project libft in the School 42 Málaga core cursus. It's a custom-made library of useful functions in C language. The repository includes the Makefile
and the libft.h
library.
About · Index · Requirements · Instructions · Testing
This project is a C library of useful functions that are allowed to be used in future School 42 cursus projects. With access to this library, the coding proccess in incoming projects will be more effective. The aim of rewrite this functions is to get a better understanding of them, and get a whide range of utilities for the next projects. You can find more information in the subject. As it's specified in the subjet, all the archives are in the same folder.
The code in this repository follows the rules of the Norminette.
ft_isascii
- Test a character to see if it's a 7-bit ASCII character.ft_isalpha
- Test a character to see if it's alphabetic.ft_isdigit
- Test a character to see if it's a decimal digit.ft_isalnum
- Test a character to see if it's alphanumeric.ft_isprint
- Test a character to see if it's any printable character, including a space.ft_tolower
- Convert a character to lowercase.ft_toupper
- Convert a character to uppercase.
ft_atoi
- Convert ASCII string to integer.ft_calloc
- Allocate space for an array and initializes it to 0. This function andmalloc
return a void pointer, that had no associated data type with it. A void pointer can hold address of any type and can be typecasted to any type.
ft_bzero
- Set the first part of an object to null bytes (filling it with zeroes).ft_memset
- Set memory to a given value.ft_memchr
- Find the first occurrence of a character in a buffer (locate byte in byte string).ft_memcmp
- Compare the bytes in two buffers.ft_memmove
- Copy bytes from one buffer to another, handling overlapping memory correctly.ft_memcpy
- Copy bytes from one buffer to another.
ft_strlen
- Get the length of a string.ft_strchr
- Find the first occurrence of a character in a string.ft_strrchr
- Find the last occurrence of a character in a string.ft_strnstr
- Locate a substring in a string.ft_strncmp
- Compare two strings, up to a given length.ft_strdup
- Create a duplicate of a string, usingmalloc
.ft_strlcpy
- Size-bounded string copy.ft_strlcat
- Size-bounded string concatenation.
ft_itoa
- Convert integer to ASCII string.ft_substr
- Get a substring from string.ft_strtrim
- Trim beginning and end of string with the specified substring.ft_strjoin
- Concatenate two strings into a new string, usingcalloc
.ft_split
- Split string, with specified character as delimiter, into an array of strings.ft_strmapi
- Create new string from a string modified with a specified function.ft_striteri
- Modify a string with a given function.ft_putchar_fd
- Output a character to given file.ft_putstr_fd
- Output string to given file.ft_putendl_fd
- Output string to given file with newline.ft_putnbr_fd
- Output integer to given file.
ft_lstnew
- Create new list.ft_lstsize
- Count elements of a list.ft_lstlast
- Find last element of list.ft_lstadd_back
- Add new element at end of list.ft_lstadd_front
- Add new element at beginning of list.ft_lstdelone
- Delete element from list.ft_lstclear
- Delete sequence of elements of list from a starting point.ft_lstiter
- Apply function to content of all list's elements.ft_lstmap
- Apply function to content of all list's elements into new list.
The library is written in C language and needs the gcc
compiler, with <stdlib.h>
and <unistd.h>
standard libraries to run.
To compile the library, go to its path and run:
For basic functions:
$ make
For bonus functions:
$ make bonus
To delete all files generated with make, go to the path and run:
$ make fclean
To use the library functions in your code, simply include this header:
#include "libft.h"
This library have been tested with Francinette.