https://github.com/nihilantropy/ft_printf
ft_printf 42 school project
https://github.com/nihilantropy/ft_printf
42school c coding ftprintf ftprintf42 library
Last synced: 2 months ago
JSON representation
ft_printf 42 school project
- Host: GitHub
- URL: https://github.com/nihilantropy/ft_printf
- Owner: Nihilantropy
- Created: 2024-08-25T13:45:19.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-26T08:52:03.000Z (over 1 year ago)
- Last Synced: 2024-08-26T16:55:59.511Z (over 1 year ago)
- Topics: 42school, c, coding, ftprintf, ftprintf42, library
- Language: C
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### 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
```bash
cd ft_printf && make
```
Now you have your ft_printf library :book:! 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 :it:!
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 :star:!
If you'd like to see an in-depth analisy of this code, leave a star to let us know! :love_letter: