Development repo for 42cursus' get_next_line project
For further information about 42cursus and its projects, please refer to 42cursus repo.
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.
@root
Note: files contain both mandatory and all bonus requirements.
Basic Libc functions
ft_strlcpy
- copy string to another locationft_strlcat
- concatenate stringsft_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 integerft_isascii
- check if a character is in the ascii tableft_isprint
- check if a character is printableft_isdigit
- check if a character is a digitft_isupper
- check if a character is uppercaseft_islower
- check if a character is lowercaseft_memset
- fill memory with a constant byteft_memmove
- copy memory areaft_strlcpy
- size-bounded string copyingft_strlcat
- size-bounded string concatenationft_strchr
- locate first character instance in stringft_strrchr
- locate last character instance in stringft_strncmp
- compare two strings within given sizeft_memchr
- scan memory for a characterft_memcmp
- compare memory areasft_strnstr
- locate a substring in a stringft_calloc
- allocates memory for an array of a given lengthft_strdup
- duplicate a string
Additional functions
ft_substr
- get a sub string from the original stringft_strjoin
- concatenate two stringsft_strtrim
- remove targeted charactersft_split
- split string into a 2d arrayft_itoa
- convert numbers to stringft_strmapi
- apply a function on each character of a stringft_striteri
- execute a function on each character of a stringft_putchar_fd
- write a characterft_putstr_fd
- write a stringft_putnbr_fd
- write numbersft_putendl_fd
- add a new line at the end of a file
Bonus functions
ft_lstnew
- create a new linked list elementft_lstadd_front
- add an element to the front of a linked listft_lstsize
- get the size of a linked listft_lstlast
- get the last element of a linked listft_lstadd_back
- add an element to the end of a linked listft_lstdelone
- delete an element from a linked listft_lstclear
- clear a linked listft_lstiter
- apply a function to each element of a linked listft_lstmap
- apply a function to each element of a linked list & create a new list
The library is written in C language and thus needs the gcc
compiler and some standard C libraries to run.
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