-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhex.c
More file actions
34 lines (31 loc) · 1.23 KB
/
Copy pathhex.c
File metadata and controls
34 lines (31 loc) · 1.23 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* hex.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mkhoubaz <mkhoubaz@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/06 14:55:35 by mkhoubaz #+# #+# */
/* Updated: 2025/11/11 09:33:43 by mkhoubaz ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
void hex(size_t n, int *cont, int f, char text)
{
char *hextab;
if (f)
{
if (text == 'p' && !n)
{
*cont += write(1, "(nil)", 5);
return ;
}
else if (text == 'p')
*cont += write(1, "0x", 2);
f = 0;
}
hextab = "0123456789abcdef";
if (n / 16 != 0)
hex(n / 16, cont, f, text);
*cont += write(1, &hextab[n % 16], 1);
}