Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2023 | ||
3 | ** my_printf | ||
4 | ** File description: | ||
5 | ** Flag to print a %b (an int in binary) | ||
6 | */ | ||
7 | |||
8 | #include <stdarg.h> | ||
9 | #include "my.h" | ||
10 | #include "myformats.h" | ||
11 | |||
12 | 11 | int flag_b(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, temp, "01"); | |
16 | |||
17 | 11 | precise_it_int(convert_base, formating, temp); | |
18 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 10 times.
|
11 | if (formating->id_ft == 3) { |
19 | 1 | my_revstr(convert_base); | |
20 | 1 | my_strcat(convert_base, "b0"); | |
21 | 1 | my_revstr(convert_base); | |
22 | } | ||
23 | 11 | format_it_int(convert_base, formating, temp); | |
24 | 11 | my_putstrf(formating->fd, convert_base); | |
25 | 11 | return my_strlen(convert_base); | |
26 | } | ||
27 |