Skip to content

MaximeGDFR/Libft_42

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libft - 42 School Project

libft

This repository contains all archives for the project libft in the 42 School Le Havre common tree. It's a custom-made library of useful functions in C language. The repository includes the Makefile and the libft.h library.

About

This project is a C library of useful functions that are allowed to be used in future 42 School projects. Having access to this library will make the coding process in upcoming projects more efficient. The goal of rewriting these functions is to gain a better understanding of them and to build a wide range of utilities for future projects, enabling us to use everything we've coded ourselves.

The code in this repository follows the rules of the Norminette. 😮‍💨

Index

Functions from <ctype.h> library

  • ft_isascii - Test a character to see if it's a 7-bit ASCII character.
  • ft_isalpha - Test a character to see if it's alphabetic.
  • ft_isdigit - Test a character to see if it's a decimal digit.
  • ft_isalnum - Test a character to see if it's alphanumeric.
  • ft_isprint - Test a character to see if it's any printable character, including a space.
  • ft_tolower - Convert a character to lowercase.
  • ft_toupper - Convert a character to uppercase.

Functions from <stdlib.h> library

  • ft_atoi - Convert ASCII string to integer.
  • ft_calloc - Allocate space for an array and initializes it to 0. This function and malloc return a void pointer, that had no associated data type with it. A void pointer can hold address of any type and can be typecasted to any type.

Functions from <strings.h> library

  • ft_bzero - Set the first part of an object to null bytes (filling it with zeroes).
  • ft_memset - Set memory to a given value.
  • ft_memchr - Find the first occurrence of a character in a buffer (locate byte in byte string).
  • ft_memcmp - Compare the bytes in two buffers.
  • ft_memmove - Copy bytes from one buffer to another, handling overlapping memory correctly.
  • ft_memcpy - Copy bytes from one buffer to another.

Functions from <string.h> library

  • ft_strlen - Get the length of a string.
  • ft_strchr - Find the first occurrence of a character in a string.
  • ft_strrchr - Find the last occurrence of a character in a string.
  • ft_strnstr - Locate a substring in a string.
  • ft_strncmp - Compare two strings, up to a given length.
  • ft_strdup - Create a duplicate of a string, using malloc.
  • ft_strlcpy - Size-bounded string copy.
  • ft_strlcat - Size-bounded string concatenation.

Non-standard functions

  • ft_itoa - Convert integer to ASCII string.
  • ft_substr - Get a substring from string.
  • ft_strtrim - Trim beginning and end of string with the specified substring.
  • ft_strjoin - Concatenate two strings into a new string, using calloc.
  • ft_split - Split string, with specified character as delimiter, into an array of strings.
  • ft_strmapi - Create new string from a string modified with a specified function.
  • ft_striteri - Modify a string with a given function.
  • 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)

Requirements

The library is written in C language and needs the gcc compiler, with <stdlib.h> and <unistd.h> standard libraries to run.

Instructions

1. Compiling the library

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

For basic functions:

$ make

For bonus functions:

$ make bonus

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

To delete all files generated with 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 this header:

#include "libft.h"

Testing

This library have been tested with Francinette.

Releases

No releases published

Packages

No packages published