Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2023 | ||
3 | ** my_printf | ||
4 | ** File description: | ||
5 | ** Flag to print a %x (an int in hexadecimal) | ||
6 | */ | ||
7 | |||
8 | #include <stdarg.h> | ||
9 | #include "my.h" | ||
10 | #include "myformats.h" | ||
11 | |||
12 | 11 | int flag_x(va_list list, formating_t *formating) | |
13 | { | ||
14 | 11 | size_t temp = va_arg(list, size_t); | |
15 | 11 | char *convert_base = specify_it_base(formating, | |
16 | temp, "0123456789abcdef"); | ||
17 | |||
18 | 11 | precise_it_int(convert_base, formating, temp); | |
19 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 10 times.
|
11 | if (formating->id_ft == 3) { |
20 | 1 | my_revstr(convert_base); | |
21 | 1 | my_strcat(convert_base, "x0"); | |
22 | 1 | my_revstr(convert_base); | |
23 | } | ||
24 | 11 | format_it_int(convert_base, formating, temp); | |
25 | 11 | my_putstrf(formating->fd, convert_base); | |
26 | 11 | return my_strlen(convert_base); | |
27 | } | ||
28 |