Skip to content

BatuhanBilgili/Libft

Repository files navigation

Libft 42-Curses

Libft (Library of Functions)

In this project, you will be creating a library of functions, the file structure for this project is the following:

.c Files

Where all of your functions will be written in.

.h (Header)

Your header file is useful for 2 things:

  • First, instead of doing for example #include <unistd.h> in all of your .c files, you just write it once in your header and all of your .c files will read it from your header file.
  • Secondly, let's say one of your .c files uses another function from another .c file, well instead of writting that function above, just write #include "libft.h" and it will find it in your header file.
  • Thirdly, you can see why and how to use ifndef here. https://www.tutorialspoint.com/cprogramming/c_header_files.htm

Make sure you add #include "libft.h" in all of your .c files.

Makefile

Makefile is where you will create a file to compile your projects. Remember how in the piscine, you created an int main and gcc to compile the projects, well with a Makefile, you don't have to do that anymore, you just type make once you have created your Makefile.

Libft Functions

Functions from <ctype.h>

Functions from <string.h>

Functions from <stdlib.h>

  • ft_atoi - convert a string to an integer.
  • ft_calloc - allocates memory and sets its bytes' values to 0.

Non-standard functions

  • ft_substr - returns a substring from a string.
  • ft_strjoin - concatenates two strings.
  • ft_strtrim - trims the beginning and end of string with specific set of chars.
  • ft_split - splits a string using a char as parameter.
  • ft_itoa - converts a number into a string.
  • ft_strmapi - applies a function to each character of a string.
  • ft_striteri - applies a function to each character of a string.
  • ft_putchar_fd - output a char to a file descriptor.
  • ft_putstr_fd - output a string to a file descriptor.
  • ft_putendl_fd - output a string to a file descriptor, followed by a new line.
  • ft_putnbr_fd - output a number to a file descriptor.

Linked list functions

Usage

make without bonus functions.

make bonus to compile with bonuses.

gcc (fonction name) libft.a you can compile the function like this.libft.a fetches other necessary functions of the function you are running.

Link To Libft Tester

I suggest you to test the functions before posting and in this link it says how to do it: https://github.com/Tripouille/libftTester

Success Rate

Ekran Resmi 2022-10-24 20 41 11