Skip to content

iflis7/libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libft

My very first C library This project is about coding a C library. It contains a lot of general purpose functions my programs rely upon.. Version: 10.

42cursus' libft

Development repo for 42cursus libft project
For further information about 42cursus and its projects, please refer to 42cursus repo.

Made with C GitHub code size in bytes Number of lines of code Code language count GitHub top language GitHub last commit


🗣️ About

The aim of this project is to code a C library regrouping usual functions that you'll be allowed to use in all your other projects.

For detailed information, refer to the subject of this project.

🚀 TLDR: this project consists of coding basic C functions (see below), which are then compiled
into a library for use in other projects of the cursus.

Functions from <ctype.h> library

Functions from <stdlib.h> library

  • ft_atoi - convert ASCII string to integer.

Functions from <strings.h> library

Functions from <string.h> library

  • ft_strlen - find length of string.
  • ft_strchr - locate character in string (first occurrence).
  • ft_strrchr - locate character in string (last occurence).
  • ft_strstr * - locate a substring in a string.
  • ft_strnstr - locate a substring in a string (size-bounded).
  • ft_strcmp * - compare strings.
  • ft_strncmp * - compare strings (size-bounded).
  • ft_strdup - save a copy of a string (with malloc).
  • ft_strncat * - iterate and apply the func on every char.
  • ft_strlcpy - size-bounded string copying.
  • ft_strlcat - size-bounded string concatenation.

Non-standard functions

  • 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_itoa - convert integer to ASCII string.
  • ft_strtrim - trim beginning and end of string with the specified characters.
  • ft_strjoin - concatenate two strings into a new string (with malloc).
  • ft_split - split string, with specified character as delimiter, into an array of strings.
  • ft_strmapi - create new string from modifying string with specified function.

Linked list functions

Note: functions marked with * are bonus functions (not mandatory by the project's subject).

📑 Tools

@tools

includes get_next_line and printf functions.

🛠️ Usage

Requirements

The library is written in C language and thus needs the gcc compiler and some standard C libraries to run.

Instructions

1. Compiling the library

To compile the library, run:

$ cd path/to/libft && make

2. Using it in your code

To use the library functions in your code, simply include its header:

#include "libft.h"

and, when compiling your code, add the required flags:

-lft -L path/to/libft.a -I path/to/libft.h

📋 Testing

1. First, configure the path to the libft folder in the Makefile (inside /testing/):

#############################
## Path to Libft directory ##
#############################
DIR		= ../

2. Then run:

make 

Third-party testers

hsaadi's 42 Libft Score

About

This project is about coding a C library. It contains a lot of general purpose functions my programs rely upon

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published