-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_proc_hex_l.c
31 lines (26 loc) · 1.21 KB
/
ft_proc_hex_l.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_proc_hex_l.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: youngmki <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/09/23 19:44:00 by youngmki #+# #+# */
/* Updated: 2021/09/23 19:44:34 by youngmki ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
static void ft_puthex(unsigned int nbr, t_print *tab)
{
const char *hex;
hex = "0123456789abcdef";
if (nbr >= 16)
ft_puthex(nbr / 16, tab);
tab->total_length += write(1, &hex[nbr % 16], 1);
}
void ft_proc_hex_lower(t_print *tab)
{
unsigned int nbr;
nbr = va_arg(tab->args, unsigned int);
ft_puthex(nbr, tab);
}