-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf_dec_functions.c
38 lines (35 loc) · 1.46 KB
/
ft_printf_dec_functions.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
37
38
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_printf_dec_functions.c :+: :+: */
/* +:+ */
/* By: cwesseli <[email protected]> +#+ */
/* +#+ */
/* Created: 2022/10/25 09:56:33 by cwesseli #+# #+# */
/* Updated: 2022/11/01 13:25:08 by cwesseli ######## odam.nl */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_print_hex(t_print *list, char c)
{
if (c == 'X')
ft_printf_itoa_u(list, va_arg(list->args,
unsigned int), list->base_h_up);
else if (c == 'x')
ft_printf_itoa_u(list, va_arg(list->args,
unsigned int), list->base_h);
else
{
list->len += write(1, "0x", 2);
ft_printf_itoa_u(list, va_arg(list->args,
unsigned long long int), list->base_h);
}
}
void ft_print_dec(t_print *list, char c)
{
if (c == 'u')
ft_printf_itoa_u(list, va_arg(list->args,
unsigned int), list->base_d);
else
ft_printf_itoa(list, va_arg(list->args, int), list->base_d);
}