Skip to content

Latest commit

 

History

History
152 lines (109 loc) · 6.21 KB

README.md

File metadata and controls

152 lines (109 loc) · 6.21 KB

🧰 libft

YOUR VERY FIRST OWN LIBRARY

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


💡 About the project

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.

Programming in C can be very tedious when you don't have access to the very useful standard functions.
This project gives you the opportunity to rewrite those functions to understand them and learn to use them.
The library will help you for your future projects in C. Through this project, you have the opportunity
to extend your list of functions in your own way!

For more detailed information, look at the subject of this project.

NOTE: To be successful with moulinette on this project I had to put all the files in the same directory. I have just put them in folders and modified the Makefile to have a better organized repository.

List of functions:

Functions from <ctype.h> library

Functions from <stdlib.h> library

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_strnstr - locate a substring in a string (size-bounded).
  • ft_strncmp - compare strings (size-bounded).
  • ft_strdup - save a copy of a string (with malloc).
  • ft_strlcpy - size-bounded string copying.
  • ft_strlcat - size-bounded string concatenation.

Non-standard functions

  • ft_itoa - convert integer to ASCII string.
  • ft_substr - extract substring from 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.
  • ft_striteri -
  • 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.

Linked list functions (bonus)

🛠️ Usage

Requirements

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

Instructions

1. Compiling the library

To compile the library, go to its path and run:

For all mandatory functions:

$ make

For bonus functions:

$ make bonus

2. Cleaning all binary (.o) and executable files (.a)

To clean all files generated while doing a make, go to the path and run:

$ make fclean

3. Using it in your code

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

#include "libft.h"

📋 Testing

You can use any of this third party testers to test the project