https://github.com/iker-gonzalez/libft
Basic C functions compiled into a library used throughout the 42 cursus.
https://github.com/iker-gonzalez/libft
42cursus bash basic-programming c library linux standard-library
Last synced: about 1 year ago
JSON representation
Basic C functions compiled into a library used throughout the 42 cursus.
- Host: GitHub
- URL: https://github.com/iker-gonzalez/libft
- Owner: iker-gonzalez
- License: mit
- Created: 2022-06-03T15:47:55.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-05T11:13:52.000Z (almost 4 years ago)
- Last Synced: 2025-01-14T05:33:54.196Z (about 1 year ago)
- Topics: 42cursus, bash, basic-programming, c, library, linux, standard-library
- Language: C
- Homepage:
- Size: 1.28 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
๐ฏ libft
Development repo for 42cursus' libft project
For further information about 42cursus and its projects, please refer to 42cursus repo
About
ยท
Usage
ยท
Testing
---
## ๐ฃ๏ธ 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 more detailed information, look at the [**subject of this project.**](https://github.com/iker-gonzalez/42_cursus/blob/main/_PDFs/en.subject_libft.pdf)
๐ 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.
## List of functions:
### Functions from `` library
* [`ft_isascii`](ft_isascii.c) - test for ASCII character.
* [`ft_isalnum`](ft_isalnum.c) - alphanumeric character test.
* [`ft_isalpha`](ft_isalpha.c) - alphabetic character test.
* [`ft_isdigit`](ft_isdigit.c) - decimal-digit character test.
* [`ft_isprint`](ft_isprint.c) - printing character test (space character inclusive).
* [`ft_tolower`](ft_tolower.c) - upper case to lower case letter conversion.
* [`ft_toupper`](ft_toupper.c) - lower case to upper case letter conversion.
### Functions from `` library
* [`ft_atoi`](ft_atoi.c) - convert ASCII string to integer.
* [`ft_calloc`](ft_calloc.c) - memory allocation.
### Functions from `` library
* [`ft_bzero`](ft_bzero.c) - write zeroes to a byte string.
* [`ft_memset`](ft_memset.c) - write a byte to a byte string.
* [`ft_memchr`](ft_memchr.c) - locate byte in byte string.
* [`ft_memcmp`](ft_memcmp.c) - compare byte string.
* [`ft_memmove`](ft_memmove.c) - copy byte string.
* [`ft_memcpy`](ft_memcpy.c) - copy memory area.
### Functions from `` library
* [`ft_strlen`](ft_strlen.c) - find length of string.
* [`ft_strchr`](ft_strchr.c) - locate character in string (first occurrence).
* [`ft_strrchr`](ft_strrchr.c) - locate character in string (last occurence).
* [`ft_strnstr`](ft_strnstr.c) - locate a substring in a string (size-bounded).
* [`ft_strncmp`](ft_strncmp.c) - compare strings (size-bounded).
* [`ft_strdup`](ft_strdup.c) - save a copy of a string (with malloc).
* [`ft_strlcpy`](ft_strlcpy.c) - size-bounded string copying.
* [`ft_strlcat`](ft_strlcat.c) - size-bounded string concatenation.
### Non-standard functions
* [`ft_itoa`](ft_itoa.c) - convert integer to ASCII string.
* [`ft_substr`](ft_substr.c) - extract substring from string.
* [`ft_strtrim`](ft_strtrim.c) - trim beginning and end of string with the specified characters.
* [`ft_strjoin`](ft_strjoin.c) - concatenate two strings into a new string (with malloc).
* [`ft_split`](ft_split.c) - split string, with specified character as delimiter, into an array of strings.
* [`ft_strmapi`](ft_strmapi.c) - create new string from modifying string with specified function.
* [`ft_striteri`](ft_striteri.c) -
* [`ft_putchar_fd`](ft_putchar_fd.c) - output a character to given file.
* [`ft_putstr_fd`](ft_putstr_fd.c) - output string to given file.
* [`ft_putendl_fd`](ft_putendl_fd.c) - output string to given file with newline.
* [`ft_putnbr_fd`](ft_putnbr_fd.c) - output integer to given file.
### Linked list functions (bonus)
* [`ft_lstnew`](ft_lstnew.c) - create new list.
* [`ft_lstsize`](ft_lstsize.c) - count elements of a list.
* [`ft_lstlast`](ft_lstlast.c) - find last element of list.
* [`ft_lstadd_back`](ft_lstadd_back.c) - add new element at end of list.
* [`ft_lstadd_front`](ft_lstadd_front.c) - add new element at beginning of list.
* [`ft_lstdelone`](ft_lstdelone.c) - delete element from list.
* [`ft_lstclear`](ft_lstclear.c) - delete sequence of elements of list from a starting point.
* [`ft_lstiter`](ft_lstiter.c) - apply function to content of all list's elements.
* [`ft_lstmap`](ft_lstmap.c) - apply function to content of all list's elements into new list.
## ๐ ๏ธ Usage
### Requirements
The library is written in C language and needs the **`gcc` compiler** and some standard **C libraries** to run.
### Instructions
**1. Compiling the library**
To compile the library, go to its path and run:
For all mandatory functions:
```shell
$ make
```
For bonus functions:
```shell
$ make bonus
```
**2. Cleaning all binary (.o) and executable files (.a)**
To clean all files generated while doing a make, go to the path and run:
```shell
$ make fclean
```
**3. Using it in your code**
To use the library functions in your code, simply include its header:
```C
#include "libft.h"
```
## ๐ Testing
You can use any of this third party testers to test the project
* [Tripouille/libfTester](https://github.com/Tripouille/libftTester)
* [ska42/libft-war-machine](https://github.com/ska42/libft-war-machine)
* [alelievr/libft-unit-test](https://github.com/alelievr/libft-unit-test)