Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

'School 42' project. C library with my own implementation of some useful functions and modules.

License

NotificationsYou must be signed in to change notification settings

elijahkash/libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 avector 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 (likexdd 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.)

Foreword

  • Be welcome to use my lib,clone andfork it!
  • If you find a bug, please, create newissue (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 youclone/fork this lib and realise some new feature, you can createpull request! I am definitely interested in this!
  • Also, I will be happy if youfollow 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

How to use:

1. Compile

  • runmake ormake libft to compilelibft.a
  • runmake clean to delete tmp files after compile (onlylibft.a will be remain)
  • runmake fclean to delete all files after compile
  • runmake cmake if you change any filename.c/h to update the configuration of build (and include new file)
  • runmake re to recompile all files

There is no real need to do this! If you change a file and runmake, the project will recompile this file, as well as all files that depend on this file and relink the lib!

2. Include

To uselibft in you project:

  • just#include <libft.h>
  • compile you files with-I /libft/includes
  • compilelibft
  • link you binary with-L /libft -lft

3. Debug

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

  • runmake debug

libftdebug.a will be created, and compiler flags now will be-g3 -Wall -Wextra.

4. Quick opportunity test

If you want to quick execute some code, to test something (does not matter what exactly), write it in/test/test.c than

  • runmake 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!

5. If you use Visual Studio code ...

... then you can find something useful in.vscode

  • pressCMD + SHIFT + B to buildlibft.a (default keys is VSC) - same to runmake
  • pressF5 to buildlibftdebug.a,/test/test, and start debug session of/test/test binary

6. Cmake

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!

Template

Want to start new project and use mylibft?

You can useTHIS TEMPLATE

If you don't know nothing about template repositories,read man!

NORMINETTE

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

Contributors

  • I would like to say a few words of gratitude to my teammate @odrinkwa (@semrunner) by theft_printfproject, for developfloat/double/long double part of printf! Thanks a lot!

License

  • See theLICENSE file for license rights and limitations (MIT).

Support

  • If you like my activity, you may say “thank you” to me and support me for any amount! Use 'Sponsor' button in github!

About

'School 42' project. C library with my own implementation of some useful functions and modules.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp