Skip to content

JosepharDev/libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libft

A custom C standard-library implementation from the 42 curriculum, packaged as a static library (libft.a).

This project provides:

  • Core character, string, memory, and conversion utilities.
  • File-descriptor output helpers.
  • Bonus singly linked-list helpers (t_list).

Project Layout

libft/
├── Makefile
├── libft.h
├── ft_*.c
└── ft_lst*_bonus.c

Build

Build the main library:

make

Build bonus objects and append them to the library:

make bonus

Clean objects:

make clean

Clean everything (objects + libft.a):

make fclean

Rebuild from scratch:

make re

Output

After make, you get:

  • libft.a — static archive containing the compiled functions.

How to Use

1) Include the header

#include "libft.h"

2) Build with your project

cc -Wall -Wextra -Werror main.c libft.a -o app

Or link from parent directory:

cc -Wall -Wextra -Werror main.c -L./libft -lft -I./libft -o app

API Overview

Part 1 — libc-like and utility functions

Character checks / transforms

  • ft_isalpha
  • ft_isdigit
  • ft_isalnum
  • ft_isascii
  • ft_isprint
  • ft_toupper
  • ft_tolower

String functions

  • ft_strlen
  • ft_strchr
  • ft_strrchr
  • ft_strncmp
  • ft_strnstr
  • ft_strdup
  • ft_strlcpy
  • ft_strlcat
  • ft_substr
  • ft_strjoin
  • ft_strtrim
  • ft_split
  • ft_strmapi
  • ft_striteri

Memory functions

  • ft_memset
  • ft_bzero
  • ft_memcpy
  • ft_memmove
  • ft_memchr
  • ft_memcmp
  • ft_calloc

Conversions

  • ft_atoi
  • ft_itoa

File-descriptor output

  • ft_putchar_fd
  • ft_putstr_fd
  • ft_putendl_fd
  • ft_putnbr_fd

Bonus — linked list (t_list)

Defined in libft.h:

typedef struct s_list
{
	void			*content;
	struct s_list	*next;
} t_list;

Implemented helpers:

  • ft_lstnew
  • ft_lstadd_front
  • ft_lstadd_back
  • ft_lstsize
  • ft_lstlast
  • ft_lstdelone
  • ft_lstclear
  • ft_lstiter

Notes specific to this repository

  • ft_lstmap_bonus.c exists but currently contains only a declaration (no function body).
  • Makefile bonus sources (BSRC) currently do not include ft_lstmap_bonus.
  • libft.h currently does not expose a ft_lstmap prototype.

So in its current state, ft_lstmap is not part of the usable API.

Minimal Example

#include "libft.h"
#include <unistd.h>

int main(void)
{
	char **parts = ft_split("42-libft-project", '-');
	if (parts)
	{
		ft_putendl_fd(parts[0], 1); // 42
		ft_putendl_fd(parts[1], 1); // libft
		ft_putendl_fd(parts[2], 1); // project
	}
	return (0);
}

Compile example:

cc -Wall -Wextra -Werror main.c -L. -lft -I. -o demo

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors