This project is one of the first and major in School 42.
This is C
library with my own implementation of some of the libc
functions including some additional useful ones.
At the first stage of schooling (about 10 projects for me) we had to use C
language, and Standart C Library is forbidden for us! So, starting with such basic utilites as memcpy(); memmove(); strlen();
, I wrote this library for use it in all of the following C
projects. Now, in addition to the basic functions, it contains a number of useful modules.
Here is a partial list:
- simple memory manager
- dynamic array (similar to a
vector
in c++) - dynamic cyclical deque
- dynamic list, realised on array (for best performance)
- get_next_line() (aka getline() from libc) + fast_input_gnl()
- ft_printf() (my own printf() from stdio.h)
- output buffer (implemented for ft_printf() but as part of the libft)
- print_memory (like
xdd
util in unix) - qsort
- and other
More detailed description posted on wiki
Also this library includes 3 projects of "School 42": libft, ft_get_next_line, ft_printf (Sorry for Google, but by law, I can't upload tasks.)
- Be welcome to use my lib,
clone
andfork
it! - If you find a bug, please, create new
issue
(or contact with me in any way you want) to report about it! I will be glad to fix it! If you find a mistake in my spelling (because I'm from Russia, and English is not my native language), please notify me too! - If you
clone/fork
this lib and realise some new feature, you can createpull request
! I am definitely interested in this! - Also, I will be happy if you
follow
me, orstar
this project, ecpecially if you find it usefull, or use my code! - For all questions be welcome to contact me in any way you want 👋
Here is my mail: elijahkash.code@gmail.com
- run
make
ormake libft
to compilelibft.a
- run
make clean
to delete tmp files after compile (onlylibft.a
will be remain) - run
make fclean
to delete all files after compile - run
make cmake
if you change any filename.c/h to update the configuration of build (and include new file) - run
make re
to recompile all files
There is no real need to do this! If you change a file and run
make
, the project will recompile this file, as well as all files that depend on this file and relink the lib!
To use libft
in you project:
- just
#include <libft.h>
- compile you files with
-I /libft/includes
- compile
libft
- link you binary with
-L /libft -lft
If you run make
or make libft
, the compiler will compile the library with the -O3 -Wall -Wextra -Werror
flags for better code performance and strict error checking!
But if you want to debug some code, you probably want to ignore warnings and be able to use a debugger (lldb, gdb, etc.).
In that case
- run
make debug
libftdebug.a
will be created, and compiler flags now will be -g3 -Wall -Wextra
.
If you want to quick execute some code, to test something (does not matter what exactly), write it in /test/test.c than
- run
make test
/test/test
binary file will be created! Also, it use libftdebug.a
(and build it, if necessary) and use -g3
flag, so you can use debugger to debug you code!
... then you can find something useful in .vscode
- press
CMD + SHIFT + B
to buildlibft.a
(default keys is VSC) - same to runmake
- press
F5
to buildlibftdebug.a
,/test/test
, and start debug session of/test/test
binary
In fact, I use Cmake
, to compile this lib. You may find CMakeLists.txt with it config.
If you use my project, as submodule
for you project, and use Cmake
too, you can add_subdirectory(${LIBFT_DIR})
and add_dependencies(${YOUR_PROJECT} libft)
or add_dependencies(${YOUR_PROJECT_DEBUG} libftdebug)
to easy configure dependencies!
Of course, first time I don't use Cmake, because it's forbidden by subject! So if you just started in 42, watch out! Write you own Makefile!
Want to start new project and use my libft
?
You can use THIS TEMPLATE
If you don't know nothing about template repositories, read man!
If you are part of the 42 society, you now all about the norminette and you may skip this part.
Otherwise, you may discover some strange code
and /file_structure in this project.
This is becouse all project in 42 must be written in accordance with the NORM.
Here are the point that most affect the code:
- You cannot have more than 5 function-definitions in a
.c
file.
We have programm called norminette
. It check every project. If it found an error, project considered as FAIL
- I would like to say a few words of gratitude to my teammate @odrinkwa (@semrunner) by the
ft_printf
project, for developfloat/double/long double
part of printf! Thanks a lot!
- See the LICENSE file for license rights and limitations (MIT).
- If you like my activity, you may say “thank you” to me and support me for any amount! Use 'Sponsor' button in github!