-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printres.c
36 lines (34 loc) · 1.54 KB
/
ft_printres.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printres.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bkaztaou <bkaztaou@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/14 15:16:52 by bkaztaou #+# #+# */
/* Updated: 2023/03/05 15:58:40 by bkaztaou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_printres(char c, va_list args, int *len)
{
if (c == '%')
*len += ft_putchar_len('%');
else if (c == 's')
*len += ft_putstr_len(va_arg(args, char *));
else if (c == 'c')
*len += ft_putchar_len(va_arg(args, int));
else if (c == 'd' || c == 'i')
ft_putnbr_len(va_arg(args, int), len);
else if (c == 'u')
ft_putunbr_len(va_arg(args, unsigned int), len);
else if (c == 'x')
ft_puthexa(va_arg(args, unsigned int), "0123456789abcdef", len);
else if (c == 'X')
ft_puthexa(va_arg(args, unsigned int), "0123456789ABCDEF", len);
else if (c == 'p')
{
*len += ft_putstr_len("0x");
ft_putadress(va_arg(args, unsigned long long), len);
}
}