-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_puthexa.c
38 lines (32 loc) · 1.31 KB
/
ft_puthexa.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_puthexa.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vde-vasc <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/13 10:31:38 by vde-vasc #+# #+# */
/* Updated: 2022/07/21 14:55:09 by vde-vasc ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_puthexa(unsigned long num, char flag)
{
static int count;
char *base;
char *base2;
count = 0;
base = "0123456789abcdef";
base2 = "0123456789ABCDEF";
if (num >= 16)
ft_puthexa(num / 16, flag);
if (flag == 'X')
count += ft_putchar(base2[num % 16]);
else
count += ft_putchar(base[num % 16]);
return (count);
}
int ft_puthexa_case(unsigned long num, char flag)
{
return (ft_puthexa(num, flag));
}