Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
** EPITECH PROJECT, 2023 |
3 |
|
|
** my_printf |
4 |
|
|
** File description: |
5 |
|
|
** Flag to print %p (an address in hexadecimal) |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
#include <stdarg.h> |
9 |
|
|
#include <stdio.h> |
10 |
|
|
#include "my.h" |
11 |
|
|
#include "myformats.h" |
12 |
|
|
|
13 |
|
1 |
int flag_p(va_list list, formating_t *formating) |
14 |
|
|
{ |
15 |
|
1 |
unsigned long int temp = va_arg(list, unsigned long int); |
16 |
|
1 |
char *address_hexa = my_str_nbr_base_unsigned(temp, "0123456789abcdef"); |
17 |
|
|
|
18 |
|
1 |
precise_it_int(address_hexa, formating, temp); |
19 |
|
1 |
my_revstr(address_hexa); |
20 |
|
1 |
my_strcat(address_hexa, "x0"); |
21 |
|
1 |
my_revstr(address_hexa); |
22 |
|
1 |
format_it_int(address_hexa, formating, temp); |
23 |
|
1 |
my_putstrf(formating->fd, address_hexa); |
24 |
|
1 |
return my_strlen(address_hexa); |
25 |
|
|
} |
26 |
|
|
|