summaryrefslogtreecommitdiff
path: root/libft/ft_putstr_fd.c
blob: e971974088a3d78436ca91a8f5ec6617290f1177 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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));
}