/libft

A personal implementation of LIBC. The C standard library.

Primary LanguageC

banner-github

❓ What is libft.

Libft is one of many 42SP projects, in this project we need to re-create some of the functions from the standard C library libc. We will use the functions created in this library in all other projects during graduation. This project aims to make students understand the basics of data structures and algorithms.

🔧 Testing the implementation.

To test the code we're going to use Libft war machine.

  1. Clone this repository
git clone https://github.com/Gabriel-Jeronimo/libft.git
  1. Clone libft-war-machine repository.
git clone https://github.com/ska42/libft-war-machine.git
  1. Move into the libft-war-machine repository and create config file.
cd libft-war-machine
bash grademe.sh
  1. Change the PATH_LIBFT in the makefile.
nano my_config.sh
#!/bin/bash

###################################
#     Mandatory configuration     #
###################################

#Edit the next line with the path of your libft project.
PATH_LIBFT=caminho_da_libft
  1. Run the test script.
bash grademe.sh

📑 List of functions

Functions from <ctype.h>

Functions from <string.h>

Functions from <stdlib.h>

  • ft_atoi - convert a string to an integer.
  • ft_calloc - allocates memory and sets its bytes' values to 0.

Non-standard functions

  • ft_substr - returns a substring from a string.
  • ft_strjoin - concatenates two strings.
  • ft_strtrim- trims the beginning and end of a string with a specific set of chars.
  • ft_split - splits a string using a char as parameter.
  • ft_itoa - converts a number into a string.
  • ft_strmapi - applies a function to each character of a string.
  • ft_striteri - applies a function to each character of a string.
  • ft_putchar_fd - output a char to a file descriptor.
  • ft_putstr_fd - output a string to a file descriptor.
  • ft_putendl_fd - output a string to a file descriptor, followed by a new line.
  • ft_putnbr_fd - output a number to a file descriptor. Linked list functions
  • ft_lstnew - creates a new list element.
  • ft_lstadd_front - adds an element at the beginning of a list.
  • ft_lstsize - counts the number of elements in a list.
  • ft_lstlast - returns the last element of the list.
  • ft_lstadd_back - adds an element at the end of a list.
  • ft_lstclear - deletes and free list.
  • ft_lstiter - applies a function to each element of a list.
  • ft_lstmap - applies a function to each element of a list.