The ft_printf project is part of the 42 school curriculum, challenging students to implement their own version of the standard C library's printf function. This project aims to deepen understanding of variadic functions and improve string manipulation skills in C.
The ft_printf function mimics the behavior of the standard printf function and supports a subset of its format specifiers. Key features include:
- String formatting:
%s,%c,%d,%i,%u,%x,%X,%p, and more. - Width and precision: Specifying field width and precision with the * or numeric values.
- sFlags: Supporting flags such as 0, -, +, (space), and #.
- Clone the project:
git clone https://github.com/seungwonme/ft_printf- Navigate to the project directory:
cd ft_printf && rm -rf .git- Compile the library:
make- Link the library in your project and include the header file:
#include "ft_printf.h"
int main(void)
{
ft_printf("Formatted output: %s %d\n", "Hello", 42);
return 0;
}- To clean up object files:
make clean- To delete all build files:
make fclean- To clean and rebuild the library:
make re%c: Character%s: String%dand%i: Signed decimal integer%u: Unsigned decimal integer%xand%X: Hexadecimal integer%p: Pointer address
For a complete list of supported features, refer to the ft_printf implementation.