42 Cursus - Libft: My implementation of some useful C functions and some additional ones to use it in future projects of 42.

42 Cursus - libft

Info

My implementation of some useful C functions and some additional ones to use it in future projects of 42.

  • Status: still updating (I use libft a lot so I keep improving it)
  • Result: 125%
  • Observations: (null)

How to install and use

  • Clone libft into your project folder
git clone https://github.com/izenynn/libft.git
  • Run make inside libft folder (make rules: all, clean, fclean, re)
make
  • Include libft.h in the header of your C file
#include <libft.h>
  • Or include only the part that you are going to use (list of functions below)
#include <libft/ft_char.h>
#include <libft/ft_str.h>
#include <libft/ft_mem.h>
#include <libft/ft_nbr.h>
#include <libft/ft_fd.h>
#include <libft/ft_lst.h>
#include <libft/ft_dlst.h>
#include <libft/ft_printf.h>

How to compile with libft

Compile directly your .c files

  • Just make sure you add libft (libft.a) and you specify libft.h path (-I flag) when you compile
gcc (...)(.c files) -o (output file) ./libft/libft.a -I ./libft/inc

Compile objects (.o) (for Makefiles)

  • If you want to compile firts your .c files into .o, you will need to specify the -c flag (no linking) when compiling to .o files, and indicate the libft.h path with the -I flag
gcc -c (.c file) -o (.o output file) -I ./libft/inc
  • Now we will compile all the .o into a program, and do the linking part with -L and -l, just specify the libft.a path with the -L flag
gcc (...)(.o files) -o (output file) -I ./libft/inc -L ./libft -lft
  • Magic

List of functions

ft_char

  • ft_islower
  • ft_isupper
  • ft_isspace
  • ft_isalpha
  • ft_isdigit
  • ft_isalnum
  • ft_isascii
  • ft_isprint
  • ft_tolower
  • ft_toupper

ft_str

  • ft_strlen
  • ft_strcpy
  • ft_strlcpy
  • ft_strcat
  • ft_strlcat
  • ft_strchr
  • ft_strrchr
  • ft_strncmp
  • ft_strnstr
  • ft_strdup
  • ft_substr
  • ft_strjoin
  • ft_strtrim
  • ft_split
  • ft_strmapi
  • ft_striteri

ft_mem

  • ft_memset
  • ft_bzero
  • ft_memcpy
  • ft_memmove
  • ft_memchr
  • ft_memcmp
  • ft_calloc

ft_nbr

  • ft_atoi
  • ft_itoa
  • ft_intlen
  • ft_intlen_base
  • ft_uintlen
  • ft_uintlen_base
  • ft_ulonglen
  • ft_ulonglen_base

ft_fd

  • ft_putchar_fd
  • ft_putstr_fd
  • ft_putendl_fd
  • ft_putnbr_fd
  • ft_get_next_line

ft_lst

  • ft_lstnew
  • ft_lstadd_front
  • ft_lstadd_back
  • ft_lstsize
  • ft_lstlast
  • ft_lstdelone
  • ft_lstclear
  • ft_lstiter
  • ft_lstmap

ft_dlst

  • ft_dlstnew
  • ft_dlstadd_front
  • ft_dlstadd_back
  • ft_dlstsize
  • ft_dlstfirst
  • ft_dlstlast
  • ft_dlstdelone
  • ft_dlstclear
  • ft_dlstiter
  • ft_dlstmap

ft_printf

  • ft_printf

ft_printf flags

  • %c print a single character.
  • %s print a string of characters.
  • %p the void * pointer argument is printed in hexadecimal.
  • %d print a decimal (base 10) number.
  • %i print an integer in base 10.
  • %u print an unsigned decimal (base 10) number
  • %x print a number in hexadecimal (base 16) with lowercase.
  • %X print a number in hexadecimal (base 16) with uppercase.
  • %% print a percent sign.
  • - left-justify within the given field width; Right justification is the default.
  • 0 left-pads the number with zeroes (0) instead of spaces when padding is specified.
  • . the precision in not specified in the format string, but as an additional integer value argument preceding the argument that has to be formated.
  • # used with x or X specifiers the value is preceeded with 0x or 0X respectively for the values different than zero.
  • (space) if no sign is going to be written, a blank space is inserted before the value.
  • + forces to preceed the result with a plus or minus sign (+ or -) even for positive numbers. By default, only negative numbers are preceded with a - sign.

forthebadge forthebadge

Similar Resources

A size-optimized STL implementation.

uSTL This library is obsolete. Please use the official gcc C++ standard library. uSTL is a partial implementation of the C++ standard library that foc

Jul 9, 2022

MSVC's implementation of the C++ Standard Library.

Microsoft's C++ Standard Library This is the official repository for Microsoft's implementation of the C++ Standard Library (also known as the STL), w

Aug 10, 2022

this lib with 26 template container and 10 kinds of algorithm, it is a good lib for study and usage

simple stl this lib simplify the achievement detail of common container, but add the container variety, the whole code partily follow Google Style. Em

Mar 10, 2022

Quick and dirty templating and docs generation.

Rader Quick and dirty templating and docs generation. Rader is a pre-processing (or post-processing) utility written in portable C++ 20 (only using st

Dec 19, 2021

Improved and configurable drop-in replacement to std::function that supports move only types, multiple overloads and more

fu2::function an improved drop-in replacement to std::function Provides improved implementations of std::function: copyable fu2::function move-only fu

Aug 3, 2022

LLVM libc++ without exception and RTTI, specifically for Android.

libc++ LLVM libc++, specifically for Android, removing exception and RTTI support. Source code is extracted from AOSP's llvm-project repository: git c

Aug 4, 2022

expected lite - Expected objects in C++11 and later in a single-file header-only library

expected lite: expected objects for C++11 and later expected lite is a single-file header-only library for objects that either represent a valid value

Aug 16, 2022

gsl-lite – A single-file header-only version of ISO C++ Guidelines Support Library (GSL) for C++98, C++11, and later

gsl-lite: Guidelines Support Library for C++98, C++11 up metadata build packages try online gsl-lite is an implementation of the C++ Core Guidelines S

Aug 10, 2022

C++11/14/17 std::optional with functional-style extensions and reference support

optional Single header implementation of std::optional with functional-style extensions and support for references. Clang + GCC: MSVC: std::optional i

Aug 10, 2022
An open source standard C library that includes useful functions && (Reimplementation of libc functions + own functions).
An open source standard C library that includes useful functions && (Reimplementation of libc functions + own functions).

?? LIBFT-42 : Artistic view of LIBC: ?? HOW DOES IT FEEL HAVING YOUR OWN LIB: SUBJECT : ENGLISH PDF ℹ️ What is LIBFT : This project aims to code a C l

Mar 24, 2022
This project is pretty straightforward, you have to recode printf. You will learn what is and how to implement variadic functions. Once you validate it, you will reuse this function in your future projects.
This project is pretty straightforward, you have to recode printf. You will learn what is and how to implement variadic functions. Once you validate it, you will reuse this function in your future projects.

100/100 Introduction to ft_printf This is the third project in the 1337 Curriculum #42network . This project is pretty straight forward, recode the pr

May 27, 2022
Reimplementation of some of the Standard C Library functions.
Reimplementation of some of the Standard C Library functions.

42-libft Reimplementation of some of the Standard C Library functions. This repository contains some of the standard library C functions. List of avai

Jan 26, 2022
This is the template for peripheral projects using nRF5 SDK

NRF5_SDK template project About This is the template for peripheral projects using nRF5 SDK Getting Started To get a local copy up and running follow

Nov 27, 2021
Empty STM32CubeMX Makefile Projects
Empty STM32CubeMX Makefile Projects

STM32CubeMX Empty Makefile Projects This repository provides empty Makefile-based projects created with STM32CubeMX. To prevent code duplication, the

Nov 7, 2021
FT_PRINTF is a 42 project that will allow me to remake the printf function (included in ) to be able to reuse it in my next projects.

FT_PRINTF FT_PRINTF is a 42 project that will allow me to remake the printf function (included in <stdio.h>) to be able to reuse it in my next project

May 17, 2022
Recode the printf function. This project is of moderate difficulty. It will enable you to discover variadic functions in C.

100/100 ?? Introduction to ft_printf This is the third project in the 42 Cadet Curriculum. This project is pretty straight forward, recode the printf

Apr 5, 2022
A thread-safe, easy-to-use, utility for sending and receiving notifications. It allows you to decouple different modules of your application.

NotificationManager NotificationManager is a thread-safe, easy-to-use utility for sending and receiving notifications. It allows you to decouple diffe

Dec 27, 2021
A standard conforming C++20 implementation of std::optional.

A standard conforming C++20 implementation of std::optional.

Feb 11, 2022
Windows Implementation Library

Windows Implementation Libraries (WIL) The Windows Implementation Libraries (WIL) is a header-only C++ library created to make life easier for develop

Aug 11, 2022