Skip to content

bpavlows/libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project has been created as part of the 42 curriculum by bpavlows

LIBFT

Project libft / Milestone 0 / 42 Porto

Description

The Libft project is the first milestone of the 42 school curriculum. The objective is to create a personal C library by re-coding standard C functions and adding useful utility functions. This library serves as a foundational tool for almost all subsequent C projects at 42.

Developing this library provides a deep understanding of:

  • Memory management (using malloc, free, and memset).
  • String manipulation in C.
  • Linked lists and basic data structures.

Library Functions

1. Libc Functions

Standard functions from <ctype.h>, <string.h>, and <stdlib.h>:

  • Character Checks: ft_isalpha, ft_isdigit, ft_isalnum, ft_isascii, ft_isprint.
  • String Manipulation: ft_strlen, ft_strlcpy, ft_strlcat, ft_strchr, ft_strrchr, ft_strncmp, ft_strnstr.
  • Memory Handling: ft_memset, ft_bzero, ft_memcpy, ft_memmove, ft_memchr, ft_memcmp.
  • Conversions: ft_toupper, ft_tolower, ft_atoi.
  • Allocation: ft_calloc, ft_strdup.

2. Additional Functions

Functions not found in the standard library or implemented differently:

  • ft_substr: Extracts a substring from a string.
  • ft_strjoin: Concatenates two strings into a new memory allocation.
  • ft_strtrim: Trims specific characters from the beginning and end of a string.
  • ft_split: Splits a string into an array of strings based on a delimiter.
  • ft_itoa: Converts an integer to a string.
  • ft_strmapi / ft_striteri: Applies a function to each character of a string.
  • ft_putchar_fd / ft_putstr_fd / ft_putendl_fd / ft_putnbr_fd: Output functions using file descriptors.

3. Bonus Functions (Linked Lists)

Functions to manipulate a t_list structure, including creating nodes, adding/removing elements, and clearing lists.


Instructions

This project uses a Makefile to automate the compilation process.

Compilation

To compile the library and generate the libft.a file:

make

Other Commands

make clean: Removes all object files (.o).

make fclean: Removes object files and the compiled library (libft.a).

make re: Performs a fclean followed by a make.

Usage

To use this library in your project, include the header:

#include "libft.h"

And link it during compilation:

cc main.c -L. -lft

About

Libft is a library with many functions in C.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages