This project is about recoding the printf() function from libc.
A recreation of the printf() function from libc, handling various conversion specifiers and flags,
ensuring smooth display management and error handling.
- The project must be written in
C
. - Buffer management of the original printf() should not be implemented.
- The function must handle the following conversions:
cspdiuxX%
:%c
Prints a single character.%s
Prints a string (as defined by the common C convention).%p
Thevoid *
pointer argument has to be printed in hexadecimal format.%d
Prints a decimal (base 10) number.%i
Prints an integer in base 10.%u
Prints an unsigned decimal (base 10) number.%x
Prints a number in hexadecimal (base 16) lowercase format.%X
Prints a number in hexadecimal (base 16) uppercase format.%%
Prints a percent sign.
- The implemented function will be compared against the original printf().
- The
ar
command must be used to create the library. Using thelibtool
command is forbidden. - The resulting
libftprintf.a
library must be created at the root of the repository.
- The function
ft_printf
should have the following prototype:int ft_printf(const char *, ...)
. - The function should return the number of characters printed (excluding the null byte used to end output to strings).
- The function should handle the conversion specifiers listed in the requirements.
- All necessary memory allocation must be handled appropriately, and memory leaks should be avoided.
The function ft_printf
will parse the format string and handle each conversion specifier accordingly. It will format and output the data as specified by the format string.