/Libft

C library with ft_printf and get_next_line included

Primary LanguageC

Libft

ABOUT THE PROJECT

The Libft project is a fundamental part of 42, aimed at providing a strong foundation in C programming.

This custom library includes a variety of essential C language functions designed to promote learning and practice of key concepts.

Implementation of basic functions: The library contains custom implementations of standard C functions, such as string manipulation, memory management, mathematical operations, and linked list manipulation.

Libft's functions serve as a foundation for future projects within the 42 curriculum. They provide a solid set of tools to tackle more advanced and complex tasks in subsequent projects.

In addition to basic functions, this Libft version includes the implementation of ft_printf for output formatting and get_next_line for efficient reading of lines from files or standard input. These functions have been integrated to enable their direct use from the Libft library.

FUNCTIONS OF THE LIBRARY

ft_isalpha: Checks if a character is an alphabetical character.

ft_isdigit: Checks if a character is a digit.

ft_isalnum: Checks if a character is an alphanumeric character (either an alphabet or a digit).

ft_isascii: Checks if a character is a 7-bit ASCII character.

ft_isprint: Checks if a character is a printable character (including space).

ft_strlen: Calculates the length of a string.

ft_memset: Fills a block of memory with a specific value.

ft_bzero: Sets the first n bytes of the given memory area to zero.

ft_memcpy: Copies n bytes from memory area src to memory area dest.

ft_memmove: Copies n bytes from memory area src to memory area dest, handling overlap.

ft_strlcpy: Copies a string to a specified size.

ft_strlcat: Concatenates two strings with a specified size limit.

ft_toupper: Converts a lowercase letter to uppercase.

ft_tolower: Converts an uppercase letter to lowercase.

ft_strchr: Locates the first occurrence of a character in a string.

ft_strrchr: Locates the last occurrence of a character in a string.

ft_strncmp: Compares the first n characters of two strings.

ft_memchr: Locates the first occurrence of a byte in a memory block.

ft_memcmp: Compares two memory blocks up to a specified length.

ft_strnstr: Locates a substring within a string with a specified length limit.

ft_atoi: Converts a string to an integer.

ft_calloc: Allocates memory for an array and initializes it with zeros.

ft_strdup: Duplicates a string.

ft_substr: Creates a substring from a given string.

ft_strjoin: Concatenates two strings.

ft_strtrim: Trims whitespace characters from the beginning and end of a string.

ft_split: Splits a string into an array of substrings based on a specified delimiter.

ft_itoa: Converts an integer to a string.

ft_strmapi: Applies a function to each character of a string.

ft_striteri: Applies a function to each character of a string with its index as an argument.

ft_putchar_fd: Outputs a character to a specified file descriptor.

ft_putstr_fd: Outputs a string to a specified file descriptor.

ft_putendl_fd: Outputs a string followed by a newline to a specified file descriptor.

ft_putnbr_fd: Outputs an integer to a specified file descriptor.

ft_lstnew: Creates a new list node.

ft_lstadd_front: Adds a new node at the beginning of a list.

ft_lstsize: Counts the number of elements in a list.

ft_lstlast: Returns the last element of a list.

ft_lstadd_back: Adds a new node at the end of a list.

ft_lstdelone: Deletes a node from a list without affecting the rest of the list.

ft_lstclear: Deletes all elements of a list and frees their memory.

ft_lstiter: Applies a function to each element of a list.

ft_lstmap: Applies a function to each element of a list, creating a new list.

ft_printf: A formatted output function similar to the standard printf.

get_next_line: Reads a line from a file descriptor.

HOW TO USE IT?

Clone the repository:

Open your terminal and run the following command to clone the repository:

git clone git@github.com:Ismaelm42/Libft.git

Go into your local repository folder. The project uses a Makefile to manage the build.

make

The make command will compile the project and generate the libft.a library.

Additional commands:

make re

Deletes and recompiles the project from scratch.

make clean

Removes object (.o) files generated during compilation.

make fclean

Removes object files and the library (.a).

USAGE

After compiling the library, you can use it in your projects. Make sure that your source code file includes the corresponding header (libft.h). You can include it in your source code file as follows:

#include "libft.h"

When compiling your program, be sure to link it to the libft.a library:

gcc my_program.c libft.a -o my_program

PROGRAMMING LANGUAGE

C-logo

ACKNOWLEDGMENTS

The GNU C Library Reference Manual

Linux Programmer's Manual