ft_printf
A versatile and customizable formatted output function.
Description
The ft_printf project reimplements the standard C printf function.
The goal is to create a function capable of formatting and printing different types of data, supporting multiple conversion specifiers, flags, and modifiers. This project deepens the understanding of variadic functions, parsing, and formatted output.
Features
Function Prototype
Supported Conversion Specifiers
%c- Character%s- String%p- Pointer address%d/%i- Signed integers%u- Unsigned integer%x/%X- Hexadecimal (lowercase/uppercase)%%- Percent sign
Supported Flags
-(left align)0(zero padding).(precision)#(alternate form for hex)+(force sign)- space (prepend a space for positive numbers)
Installation
Clone the repository and compile the library:
cd ft_printf
make
This will create libftprintf.a which you can link into your projects.
Usage
Example usage:
int main(void)
{
int count;
count = ft_printf("Hello %s! Number: %d, Hex: %x\n", "world", 42, 42);
ft_printf("Printed %d characters.\n", count);
return (0);
}
Compile with: