The ft_printf project aims to replicate the behavior of the standard printf function from the C standard library. The project consists of creating a custom version, ft_printf, which handles formatted output.
The function prototype is:
int ft_printf(const char *, ...);To compile the project, run:
makeThis will create the libftprintf.a library.
To clean object files:
make cleanTo remove compiled files:
make fcleanTo recompile from scratch:
make reThe ft_printf function supports the following format specifiers:
| Specifier | Description |
|---|---|
%c |
Prints a single character |
%s |
Prints a string |
%p |
Prints a pointer address in hexadecimal format |
%d |
Prints a decimal (base 10) number |
%i |
Prints an integer (base 10) |
%u |
Prints an unsigned decimal number |
%x |
Prints a hexadecimal number (lowercase) |
%X |
Prints a hexadecimal number (uppercase) |
%% |
Prints a percent sign |
- Mimics the behavior of the real
printf. - Handles variable argument lists using
va_start,va_arg,va_copy, andva_end. - Does not use buffer management.
- Built as a static library (
libftprintf.a). - Can be linked with other projects.
You can test ft_printf by using it instead of the original printf.
This project follows the 42 School project requirements and is meant for educational purposes.