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