This project aims to recreate the behavior of printf, including it's basic error handling and some of it's flags. We mainly learning about variadic arguments.
- Your function has to handle the following conversions:
<cspdiuxX%>
- Flags
<-O.*>
and minimum field width with all conversions
<%x>
||<%X>
: ft_print_hex - prints a number in hexadecimal format in lowercase and uppercase
<%p>
: ft_print_pointer - prints a pointer in hexadecimal format
<%u>
: ft_print_unsig - prints an unsigned
- ft_printf - initialization function: start/end variable argument functions where argument numbers are undefined
- ft_format - checks each format specifier and calls as functions according to the collected format specifiers.
<%c>
: ft_putchar - writes a specified character to the output unit provided
<%i>
||<%d>
: ft_putnbr - prints the characters representing the numbers
<%s>
: ft_putstr - writes the string to the given output unit
The library is written in C language and thus needs the -cc compiler and some standard C libraries to run.
Instruction
-
Compiling the project
$ make $ make fclean
-
Execute your program
$ cc ft_printf.c ft_putchar.c ft_putstr.c ft_print_unsig.c ft_print_pointer.c ft_print_hex.c ft_putnbr.c && ./a.out
Third-party testers used in the project