Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2023 | ||
3 | ** my_putstr_fd | ||
4 | ** File description: | ||
5 | ** Writes a string (str) in a file descriptor (fd) | ||
6 | ** and returns the length of the printed string | ||
7 | */ | ||
8 | /** | ||
9 | * @file my_putstr_fd.c | ||
10 | * @brief The file containing the my_putstr_fd function | ||
11 | * @author Nicolas TORO | ||
12 | */ | ||
13 | |||
14 | #include "my.h" | ||
15 | |||
16 | 42 | int my_putstr_fd(char const *str, int fd) | |
17 | { | ||
18 | int len; | ||
19 | |||
20 |
3/4✓ Branch 0 taken 41 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 41 times.
|
42 | if (str == NULL || fd < 0) |
21 | 1 | return 0; | |
22 | 41 | len = my_strlen(str); | |
23 | 41 | write(fd, str, len); | |
24 | 41 | return len; | |
25 | } | ||
26 |