Skip to content

sdadak42/Libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libft - 42 Project

Introduction

Use this libft as a static library for your future C projects. This project involves recoding a few standard C library functions as well as other utility functions that will be useful during your course.

Functions

Libc Functions

Functions from the standard C library, recoded with the same behavior:

  • ft_isalpha - Check for alphabetic character.
  • ft_isdigit - Check for digit (0 through 9).
  • ft_isalnum - Check for alphanumeric character.
  • ft_isascii - Check whether c fits into the ASCII character set.
  • ft_isprint - Check for any printable character.
  • ft_strlen - Calculate the length of a string.
  • ft_memset - Fill memory with a constant byte.
  • ft_bzero - Zero a byte string.
  • ft_memcpy - Copy memory area.
  • ft_memmove - Copy memory area (handles overlapping).
  • ft_strlcpy - Size-bounded string copying.
  • ft_strlcat - Size-bounded string concatenation.
  • ft_toupper - Convert char to uppercase.
  • ft_tolower - Convert char to lowercase.
  • ft_strchr - Locate character in string (first occurrence).
  • ft_strrchr - Locate character in string (last occurrence).
  • ft_strncmp - Compare two strings.
  • ft_memchr - Scan memory for a character.
  • ft_memcmp - Compare memory areas.
  • ft_strnstr - Locate a substring in a string.
  • ft_atoi - Convert a string to an integer.
  • ft_calloc - Allocate and zero-initialize memory.
  • ft_strdup - Duplicate a string.

Additional Functions

Useful functions that are not part of the standard Libc:

  • ft_substr - Extract a substring from a string.
  • ft_strjoin - Concatenate two strings.
  • ft_strtrim - Trim characters from the beginning and end of a string.
  • ft_split - Split a string using a delimiter.
  • ft_itoa - Convert an integer to a string.
  • ft_strmapi - Apply a function to each character of a string (with index, creating new string).
  • ft_striteri - Apply a function to each character of a string (with index, modifying in place).
  • 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 newline.
  • ft_putnbr_fd - Output an integer to a file descriptor.

Bonus Functions

Functions to manipulate linked lists (t_list):

  • ft_lstnew - Create a new list element.
  • ft_lstadd_front - Add an element to the beginning of a list.
  • ft_lstsize - Count the number of elements in a list.
  • ft_lstlast - Return the last element of a list.
  • ft_lstadd_back - Add an element to the end of a list.
  • ft_lstdelone - Delete a list element (free content).
  • ft_lstclear - Delete an entire list.
  • ft_lstiter - Apply a function to each element's content.
  • ft_lstmap - Apply a function to each element's content and create a new list.

Usage

Requirements

The library is written in C and requires a standard C compiler (like cc or gcc) and make.

Installation

Clone the repository and compile the library:

make

This will generate libft.a.

To compile with bonus functions:

make bonus

To clean object files:

make clean

To clean object files and the library:

make fclean

To recompile:

make re

Using in your project

Include the header in your C files:

#include "libft.h"

Compile your project with the library:

cc main.c libft.a

About

Implementation of standard C library functions (libc) with a focus on memory management, string manipulation, and linked lists.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors