Skip to content

This project is your very first project as a student at 42. You will need to recode a few functions of the C standard library as well as some other utility functions that you will use during your whole cursus.

Notifications You must be signed in to change notification settings

Mou-SED/libft-42-cursus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation


This project gives the opportunity to recode functions that already exist in different libraries in c programming language and others that are not. the goal is to take in hand some functions that will help us in the next projects of the 42 cursus.


> About!

Mandatory Part

Functions from <ctype.h> library

Functions from <stdlib.h> library

  • ft_atoi ~ convert ASCII string to integer.
  • ft_calloc ~ memory allocation initialize with zeros.

Functions from <strings.h> library

Functions from <string.h> library

  • ft_strlen ~ find out the length of the string.
  • ft_strchr ~ locate character in string (first occurrence).
  • ft_strrchr ~ locate character in string (last occurrence).
  • ft_strnstr ~ locate a substring in a string (of limited size).
  • ft_strncmp ~ compare strings (of limited size).
  • ft_strlcpy ~ copy strings (of limited size).
  • ft_strdup ~ save a copy of a string (using malloc).
  • ft_strlcat ~ concatenate strings of limited size (second argument of the function into the first one).

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_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 (using 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 ~ modify the string with the specified function if necessary. using the current character address.

Bonus Part

Linked list functions

> Usage!

Compilation

To make a library without the linked list functions (bonus part) :

make

or

make all

if you need to use linked list functions, you can make it with a bonus target like this :

make bonus

Linking the library

To use libft in your code, you must add the include header to your code :

#include "libft.h"

and add the libft folder to your directory and when you compile your code, just link it like this:

gcc your "file .c" -lft -L path/to/libft.a -I path/to/libft.h

> Testing!

You can use these testers to test the functionality of functions :

Tripouille libft-unit-test jtoty/libfttest

> Goal!

After completing this project, I learned a lot of information about the basics of coding using C programming. Ultimately, the goal of this library is to be able to write clean code and know how to protect my functions and, of course, to familiarize myself with the library, which will help me a lot in future projects.

About

This project is your very first project as a student at 42. You will need to recode a few functions of the C standard library as well as some other utility functions that you will use during your whole cursus.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published