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 | * @file flag_x.c | ||
9 | * @brief The file containing the flag_x function | ||
10 | * @author Nicolas TORO | ||
11 | */ | ||
12 | |||
13 | #include "myprintf.h" | ||
14 | |||
15 | 11 | int flag_x(va_list list, formating_t *formating) | |
16 | { | ||
17 | 11 | size_t temp = va_arg(list, size_t); | |
18 | 11 | char *convert_base = specify_it_base(formating, | |
19 | temp, "0123456789abcdef"); | ||
20 | |||
21 | 11 | precise_it_int(convert_base, formating, temp); | |
22 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 10 times.
|
11 | if (formating->id_ft == 3) { |
23 | 1 | my_revstr(convert_base); | |
24 | 1 | my_strcat(convert_base, "x0"); | |
25 | 1 | my_revstr(convert_base); | |
26 | } | ||
27 | 11 | format_it_int(convert_base, formating, temp); | |
28 | 11 | return my_putstr_fd_free(convert_base, formating->fd); | |
29 | } | ||
30 |