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%:%cPrints a single character.%sPrints a string (as defined by the common C convention).%pThevoid *pointer argument has to be printed in hexadecimal format.%dPrints a decimal (base 10) number.%iPrints an integer in base 10.%uPrints an unsigned decimal (base 10) number.%xPrints a number in hexadecimal (base 16) lowercase format.%XPrints a number in hexadecimal (base 16) uppercase format.%%Prints a percent sign.
- The implemented function will be compared against the original printf().
- The
arcommand must be used to create the library. Using thelibtoolcommand is forbidden. - The resulting
libftprintf.alibrary must be created at the root of the repository.
- The function
ft_printfshould 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.
