Skip to content

Leined18/Libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

120 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libft Library Functions

This library contains various useful functions for memory manipulation, strings, lists, printing, and more. The functions are detailed below, grouped by categories:

Function Types

Functions

Character Functions (is)

Function Description
ft_isalpha Checks if the character is alphabetic
ft_isalnum Checks if the character is alphanumeric
ft_isascii Checks if the character belongs to ASCII
ft_isdigit Checks if the character is a digit
ft_isprint Checks if the character is printable
ft_isspace Checks if the character is a whitespace
ft_isndup Checks if a number array has duplicates
ft_isstrnum Checks if a string is numeric

Memory Functions (mem)

Function Description
ft_bzero Sets a block of memory to zero
ft_calloc Allocates memory and initializes it to zero
ft_memchr Searches for a character in a memory block
ft_memcmp Compares memory blocks
ft_memcpy Copies a memory block
ft_memmove Moves a memory block
ft_memset Sets a value in a memory block
ft_memrev Reverses a memory block
ft_memccpy Copies up to a specific character
ft_memdel frees a memory block
ft_free_2d frees a two-dimensional array
ft_free_null frees a memory block and sets it to null
ft_hold_mem hold memory blocks address in a list

Conversion Functions (to)

Function Description
ft_atoi Converts a string to an integer
ft_atobin Converts a string to binary
ft_atol Converts a string to long
ft_atoll Converts a string to long long
ft_itoa Converts an integer to a string
ft_tolower Converts a character to lowercase
ft_toupper Converts a character to uppercase
ft_bintoa Converts binary to a string
ft_bin2char Converts binary to a char
ft_char2bin Converts a char to binary

String Functions (str)

Function Description
ft_split Splits a string into an array of strings
ft_strchr Searches for a character in a string
ft_strdup Duplicates a string
ft_striteri Iterates over a string with an index
ft_strjoin Joins two strings into one
ft_strlcat Safely concatenates strings
ft_strlcpy Safely copies strings
ft_strlen Calculates the length of a string
ft_strmapi Iterates over a string and applies a function
ft_strncmp Compares two strings
ft_strnstr Searches for a string within another string
ft_strrchr Searches for a character in a string from the end
ft_strtrim Trims whitespace from a string
ft_strrev Reverses a string
ft_substr Extracts a substring
ft_strrncmp Compares a limited number of characters
ft_strtok Splits a string into tokens
ft_straddc Appends a character to the end of a string

List Functions (lst)

Function Description
ft_lstnew_bonus Creates a new list node
ft_lstadd_front_bonus Adds a node to the front of the list
ft_lstsize_bonus Calculates the size of a list
ft_lstlast_bonus Gets the last node of the list
ft_lstadd_back_bonus Adds a node to the end of the list
ft_lstdelone_bonus Deletes a node from the list
ft_lstclear_bonus Deletes all nodes from the list
ft_lstiter_bonus Iterates over a list
ft_lstmap_bonus Applies a function to each element of the list

Output Functions (put)

Function Description
ft_putchar_fd Writes a character to a file descriptor
ft_putendl_fd Writes a line to a file descriptor
ft_putnbr_fd Writes a number to a file descriptor
ft_putstr_fd Writes a string to a file descriptor
ft_error Displays an error message with exit_failure
ft_successful Displays a success message with exit_success
ft_putstr_color_fd Writes a colored string to a file descriptor

Printing Functions (printf) / Get_next_line

Function Description
ft_printf Prints a formatted message
ft_putbase_fd Prints a number in a specific base
ft_putaddr Prints a memory address
ft_putchar Prints a character
ft_puthexa Prints a number in hexadecimal
ft_putnbr Prints a number
ft_putstr Prints a string
ft_putunsigned Prints an unsigned number
get_next_line Reads a line from a file descriptor

Math Functions (math)

Function Description
ft_abs Calculates the absolute value of a number
ft_index Finds the position of a value in an array
ft_insort Sorts an array using insertion sort
ft_sqrt Calculates the square root of a number
ft_fact Calculates the factorial of a number
ft_fib Calculates the nth number in the Fibonacci sequence

CMD Functions (cmd)

Function Description
create_command Creates a command structure with the arguments passed
redirect_output Redirects the standard output to the file descriptor passed as argument
redirect_input Redirects the standard input to the file descriptor passed as argument
create_child Creates a child process
handle_parent Handles the parent process
pipe_commands Pipes two commands as passed as arguments
execute_command Executes a command
get_cmd_path Gets the command path
parse_command Parses a command and returns a t_command struct

About

Libreria en C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors