From 1b070bfda1ebf429731c4937d6f5f4460280d9a1 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 19 Sep 2025 16:12:08 +0200 Subject: [PATCH] feat: pointer function now working --- sources/ft_printf.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sources/ft_printf.c b/sources/ft_printf.c index 172e133..3ffd37c 100644 --- a/sources/ft_printf.c +++ b/sources/ft_printf.c @@ -21,6 +21,31 @@ static int print_buff(int fd, const char *s, size_t start, size_t end) return (write(fd, s + start, (end - start))); } +static int flag_managenent(int fd, char flag, va_list args) +{ + size_t i; + const t_format flags[] = { + {'c', flag_c}, + {'d', flag_i}, + {'p', flag_p}, + {'u', flag_u}, + {'%', flag_percent}, + {'i', flag_i}, + {'s', flag_s}, + {'x', flag_x}, + {'X', flag_x_maj}, + }; + + i = 0; + while (flags[i].character) + { + if (flags[i].character == flag) + return (flags[i].function(args, fd)); + i++; + } + return (-1); +} + int ft_vdprintf(int fd, const char *s, va_list args) { size_t i;