- Notifications
You must be signed in to change notification settings - Fork0
'School 42' project. C library with my own implementation of some useful functions and modules.
License
elijahkash/libft
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This project is one of the first and major inSchool 42.This isC
library with my own implementation of some of thelibc
functions including some additional useful ones.At the first stage of schooling (about 10 projects for me) we had to useC
language, and Standart C Library is forbidden for us! So, starting with such basic utilites asmemcpy(); memmove(); strlen();
, I wrote this library for use it in all of the followingC
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 descriptionposted 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 uselibft
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 runmake
ormake 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 uselibftdebug.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 useCmake
, to compile this lib. You may findCMakeLists.txt with it config.
If you use my project, assubmodule
for you project, and useCmake
too, you canadd_subdirectory(${LIBFT_DIR})
andadd_dependencies(${YOUR_PROJECT} libft)
oradd_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 mylibft
?
You can useTHIS TEMPLATE
If you don't know nothing about template repositories,read man!
If you are part of the42 society, you now all about thenorminette and you may skip this part.Otherwise, you may discover some strangecode
and /file_structure in this project.This is becouse all project in42 must be written inaccordance 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 callednorminette
. It check every project. If it found an error, project considered asFAIL
- 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 theLICENSE 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!