Welcome to the "ft_printf" project, part of the 42 School cursus. This project is a custom implementation of the printf function in C, providing a flexible and extensible way to format and print output.
"ft_printf" is a crucial project in the 42 School cursus, challenging you to implement your version of the printf function. This project involves handling various format specifiers, such as %s, %d, %x, etc., and providing the expected output for different types of input.
To use the ft_printf function, follow these steps:
- Clone the repository:
git clone <repository_url> - Include the "ft_printf.h" header in your C file:
#include "ft_printf.h" - Compile your code with the "libftprintf.a" library:
gcc your_code.c libftprintf.a
%c: Character%s: String%dand%i: Integer%x: Lowercase hexadecimal%X: Uppercase hexadecimal%u: Unsigned integer%p: Pointer%%: Percent sign
- Description: Custom implementation of the printf function.
- Parameters:
format: A format string containing format specifiers....: Variable number of arguments corresponding to the format specifiers.
- Return Value: Returns the total number of characters printed (excluding the null-terminating byte used to end output to strings). If an error occurs, it returns -1.
- Description: Handles a specific format specifier and updates the total length. It is called by the
ft_printffunction for each encountered format specifier. - Parameters:
ap: A va_list of arguments.s: The format specifier character.len: The current total length.
- Return Value: Returns the updated total length after processing the format specifier. If an error occurs, it returns -1.
Feel free to contribute to the project by opening issues or submitting pull requests. Your contributions are highly appreciated.