You can git clone the repository using https protocol
git clone https://github.com/Nihilantropy/ft_printf.git
access the directory and run the make command
cd ft_printf && makeNow you have your ft_printf library ๐! To use it you only have to add the ft_printf.h (inside the include folder) into your program header!
Once you've done that, you can compile your fresh new program with the -L/path/to/libftprintf.a (change accordingly) and the -lftprintf flag ๐ฎ๐น!
Now that you know how to use it... let's make it!
Welcome to the world of ft_printf! ๐ This project is all about recoding the legendary printf function from the C library. If youโve ever wondered how printf works under the hood or wanted to take your C skills to the next level, this is your chance!
The aim of this project is to create your very own version of printf(), a function thatโs as versatile as it is essential in C programming. You'll dive into the world of variadic functions and discover how to format and print output in various ways.
- Function Prototype:
int ft_printf(const char *format, ...); - Handle These Conversions:
%c- Print a character.%s- Print a string.%p- Print a pointer in hexadecimal format.%d- Print a decimal number.%i- Print an integer.%u- Print an unsigned decimal number.%x- Print a number in lowercase hexadecimal.%X- Print a number in uppercase hexadecimal.%%- Print a percent sign.
- External Functions Allowed:
malloc,free,write,va_start,va_arg,va_copy,va_end - Library Creation: Use
arto make your library (libftprintf.a) and keep it in the root of your repo.
- Skip the buffer management of the original
printf(). Focus on making your function work flawlessly with the given format specifiers. - Make sure your implementation is robust and handles errors gracefully.
Feeling adventurous? Try out these bonus features to make your ft_printf even cooler (not present in this project):
- Flag Management: Implement flags like
-,0,., and handle minimum field widths. - Additional Flags: Add support for
#and+.
Note: The bonus features will only be reviewed if your mandatory part is spot onโno pressure! ๐
- Language: C
- Norm Compliance: Follow the 42 Norm to the letter. This applies to both mandatory and bonus parts.
- Error Handling: No segfaults or memory leaks allowed! Ensure your code runs smoothly.
- Makefile Must-Haves:
- Include rules for
$(NAME),all,clean,fclean, andre. - Avoid unnecessary relinking in the
bonusrule.
- Include rules for
- Libft Integration: If youโre using
libft, make sure to include it in alibftdirectory and compile it first.
Once youโre done, submit your work to your Git repository. Double-check that all files are correctly named and included. Your project will be graded based on whatโs in the repo, so make sure everything is in tip-top shape!
Congratulations! With ft_printf added to your toolkit, youโre one step closer to mastering C programming. ๐๐ป
If you'd like to see an in-depth analisy of this code, leave a star to let us know! ๐