Skip to content

ChuOkupai/libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libft

My own C library for 42 School projects

External functions used

  • free
  • malloc
  • read
  • write

Content description

  • ft_bit - Perform basic operations on bit arrays
  • ft_btree - Implementation of binary trees
  • ft_const - Contains some useful constants
  • ft_ctype - Character tests and conversions
  • ft_dlist - Implementation of doubly linked lists
  • ft_generic - Provide generic functions for common standard data types
  • ft_list - Implementation of singly linked lists
  • ft_memory - Functions concerning memory manipulation
  • ft_rbtree - Implementation of red black trees
  • ft_stdio - Basic I/O interface
  • ft_string - Fonctions concerning string manipulation
  • ft_type - Contains data types definition including generic functions pointers

Features

  • A faster printf implementation (only conversions c, d, n, o, p, s, u, and x are supported)
  • ft_get_next_line can read a file descriptor line by line, either on standard input or on a file
  • Implementation of generic data structures that do not exist in the libc

Build instructions

This project can be compiled on both Linux and Mac by the following command in a terminal:

make

It generates a static C library named libft.a.

Installation

In order to install the libft on your system, you can use the command:

sudo make install

It can be removed with:

sudo make uninstall
  • ⚠️ Note that it requires access privileges

Usage

All header files are located in the inc directory.

The main header file is called libft.h, which can be included in your source files like this:

#include "libft.h" // include all libft functions

But you can also use sub-header files if you do not want to include the entire library. For example:

#include "libft/ft_string.h" // include only libft string functions like ft_strlen

Examples

Code samples can be compiled with:

make test

Then, all compiled binaries are stored in the bin directory. You are free to test the programs and access the source code.

Compile with libft

Assuming that you are using gcc as your compiler and main.c is located at the root of the directory:

gcc -I./inc main.c -L. -lft

...or if the library has been installed on your system:

gcc main.c -lft

License

This project is licensed under the LGPLv3 License - see the LICENSE file for details