Skip to content

Nihilantropy/ft_printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

18 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Installation

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 && make

Now 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!

ft_printf ๐Ÿ› ๏ธ

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!

๐Ÿ“œ Project Overview

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.

๐ŸŽฏ Mandatory Part

What You Need to Do

  • 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 ar to make your library (libftprintf.a) and keep it in the root of your repo.

What to Keep in Mind

  • 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.

๐ŸŽ Bonus Part (not present in this project)

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! ๐Ÿ˜‰

๐Ÿ› ๏ธ Common Instructions

  • 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, and re.
    • Avoid unnecessary relinking in the bonus rule.
  • Libft Integration: If youโ€™re using libft, make sure to include it in a libft directory and compile it first.

๐Ÿš€ Submission

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. ๐ŸŽ‰๐Ÿ’ป

Leave a strar โญ!

If you'd like to see an in-depth analisy of this code, leave a star to let us know! ๐Ÿ’Œ

About

ft_printf 42 school project

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published