Files
ft_printf/libftprintf/ft_vprintf_percent.c
2022-04-26 17:53:39 +02:00

36 lines
1.4 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_vprintf_percent.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/20 11:55:58 by gbaconni #+# #+# */
/* Updated: 2022/04/26 15:40:34 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
int ft_vprintf_percent(const char *format, va_list ap)
{
int ret;
char c;
ret = 0;
c = *(format + ft_eoflags(format));
if (c == 'c')
ret = ft_vprintf_char(format, ap);
else if (c == 's')
ret = ft_vprintf_string(format, ap);
else if (c == 'p')
ret = ft_vprintf_pointer(format, ap);
else if (c == 'x' || c == 'X')
ret = ft_vprintf_hexadecimal(format, ap);
else if (c == 'd' || c == 'i' || c == 'u')
ret = ft_vprintf_decimal(format, ap);
else
ret = ft_vprintf_other(format, ap);
return (ret);
}