-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert_x.c
41 lines (36 loc) · 1.37 KB
/
convert_x.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
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* convert_x.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jmykkane <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/29 19:21:29 by jmykkane #+# #+# */
/* Updated: 2022/11/29 19:21:30 by jmykkane ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int convert_x(va_list *args, int count)
{
unsigned int num;
char *str;
int len;
num = (unsigned int)va_arg(*args, int);
str = ft_itoa(num);
len = ft_hexlen(num);
ft_puthex_lower_fd(num, 1);
free(str);
return (count + len);
}
int convert_xx(va_list *args, int count)
{
unsigned int num;
char *str;
int len;
num = (unsigned int)va_arg(*args, int);
str = ft_itoa(num);
len = ft_hexlen(num);
ft_puthex_upper_fd(num, 1);
free(str);
return (count + len);
}