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 · Instuctions · Testing · License
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 whether c is a 7-bit US-ASCII character code.ft_isalpha
: Test a character to see if it's alphabetic.ft_isdigit
: Test a character to see if it's a digit (0 through 9).ft_isalnum
: Test a character to see if it's alphanumeric; it is equivalent to (isalpha(c) || isdigit(c)).ft_isprint
: Test a character to see if it's any printable character, including a space.ft_tolower
: Convert uppercase letters to lowercase.ft_toupper
: Convert lowercase letters to uppercase.
ft_atoi
: Convert the initial portion of the string pointed to by nptr to int.ft_calloc
: Allocate unused space for an array of "count" elements each of whose size in bytes is "size" and initializes to all bits 0.
ft_bzero
: Set the data in the n bytes of the memory starting at the location pointed to by s, to null bytes (filling it with zeroes).ft_memset
: Set the first n bytes of the memory area pointed to by s with the constant byte c.ft_memchr
: Scans the initial n bytes of the memory area pointed to by s for the first instance of c.ft_memcmp
: Compare the first n bytes of the memory areas s1 and s2.ft_memmove
: Copy n bytes from memory area src to memory area dest, handling overlapping memory correctly.ft_memcpy
: Copy bytes from one buffer to another. The memory areas must not overlap. Use memmove if the memory areas do overlap.
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
: Copy up to size - 1 characters from string src to dst.ft_strlcat
: Concatenates the start of the string src to the end of dst with -1 of the size.
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 download the repository, go to the console and run:
For basic functions:
git clone https://github.com/Javisanchezf/42Malaga-libft.git 42Malaga-libft
cd 42Malaga-libft
To compile the library, go to its path and run:
For basic functions:
make all
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 the normal and strict mode of Francinette to the date of 12/12/2022.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
You are free to:
- Share: copy and redistribute the material in any medium or format.
- Adapt: remix, transform, and build upon the material.
Under the following terms:
- Attribution: You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- NonCommercial: You may not use the material for commercial purposes.
- ShareAlike: If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.