diff options
Diffstat (limited to 'libft/ft_putstr_fd.c')
-rw-r--r-- | libft/ft_putstr_fd.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libft/ft_putstr_fd.c b/libft/ft_putstr_fd.c new file mode 100644 index 0000000..e971974 --- /dev/null +++ b/libft/ft_putstr_fd.c @@ -0,0 +1,23 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_putstr_fd.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: kdx <kdx @student.42angouleme.fr +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2022/09/29 02:16:42 by kdx #+# #+# */ +/* Updated: 2022/10/04 07:56:40 by kdx ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" +#include <unistd.h> + +size_t ft_putstr_fd(char *s, int fd) +{ + if (s == NULL) + return (ft_putstr_fd("(null)", fd)); + else + write(fd, s, ft_strlen(s)); + return (ft_strlen(s)); +} |