Skip to content

Latest commit

 

History

History
129 lines (99 loc) · 4.64 KB

README.md

File metadata and controls

129 lines (99 loc) · 4.64 KB

libft

Development repo for 42cursus' get_next_line project
For further information about 42cursus and its projects, please refer to 42cursus repo.

GitHub code size in bytes Number of lines of code Code language count GitHub top language GitHub last commit


🗣️ About

The aim of this project is to code a C library regrouping usual functions that you'll be allowed to use in all your other projects.

For detailed information, refer to the subject of this project.

🚀 TLDR: this project consists of coding basic C functions (see below), which are then compiled into a library for use in other projects of the cursus.

📑 Index

@root

Note: files contain both mandatory and all bonus requirements.

Basic Libc functions

  • ft_strlcpy - copy string to another location
  • ft_strlcat - concatenate strings
  • ft_strdup - save a copy of a string (with malloc)
  • ft_strjoin - join two strings (with malloc)
  • ft_substr - extract a substring (with malloc)
  • ft_atoi - convert a string to an integer
  • ft_isascii - check if a character is in the ascii table
  • ft_isprint - check if a character is printable
  • ft_isdigit - check if a character is a digit
  • ft_isupper - check if a character is uppercase
  • ft_islower - check if a character is lowercase
  • ft_memset - fill memory with a constant byte
  • ft_memmove - copy memory area
  • ft_strlcpy - size-bounded string copying
  • ft_strlcat - size-bounded string concatenation
  • ft_strchr - locate first character instance in string
  • ft_strrchr - locate last character instance in string
  • ft_strncmp - compare two strings within given size
  • ft_memchr - scan memory for a character
  • ft_memcmp - compare memory areas
  • ft_strnstr - locate a substring in a string
  • ft_calloc - allocates memory for an array of a given length
  • ft_strdup - duplicate a string

Additional functions

  • ft_substr - get a sub string from the original string
  • ft_strjoin - concatenate two strings
  • ft_strtrim - remove targeted characters
  • ft_split - split string into a 2d array
  • ft_itoa - convert numbers to string
  • ft_strmapi - apply a function on each character of a string
  • ft_striteri - execute a function on each character of a string
  • ft_putchar_fd - write a character
  • ft_putstr_fd - write a string
  • ft_putnbr_fd - write numbers
  • ft_putendl_fd - add a new line at the end of a file

Bonus functions

  • ft_lstnew - create a new linked list element
  • ft_lstadd_front - add an element to the front of a linked list
  • ft_lstsize - get the size of a linked list
  • ft_lstlast - get the last element of a linked list
  • ft_lstadd_back - add an element to the end of a linked list
  • ft_lstdelone - delete an element from a linked list
  • ft_lstclear - clear a linked list
  • ft_lstiter - apply a function to each element of a linked list
  • ft_lstmap - apply a function to each element of a linked list & create a new list

🛠️ Usage

Requirements

The library is written in C language and thus needs the gcc compiler and some standard C libraries to run.

Instructions

1. Compiling the library

To compile the library, run:

$ cd path/to/ft_printf && make

2. Using it in your code

To use the library functions in your code, simply include its header:

#include "ft_printf.h"

and, when compiling your code, add the required flags:

-lftprintf -L path/to/libftprintf.a -I path/to/ft_printf.h

📋 Testing