/ libft / src / ft_basics / ft_putendl_fd.c
ft_putendl_fd.c
 1  /* ************************************************************************** */
 2  /*                                                                            */
 3  /*                                                        :::      ::::::::   */
 4  /*   ft_putendl_fd.c                                    :+:      :+:    :+:   */
 5  /*                                                    +:+ +:+         +:+     */
 6  /*   By: ll-hotel <ll-hotel@student.42lyon.fr>      +#+  +:+       +#+        */
 7  /*                                                +#+#+#+#+#+   +#+           */
 8  /*   Created: 2023/11/07 18:59:03 by ll-hotel          #+#    #+#             */
 9  /*   Updated: 2023/11/08 14:57:43 by ll-hotel         ###   ########.fr       */
10  /*                                                                            */
11  /* ************************************************************************** */
12  
13  #include <unistd.h>
14  
15  void	ft_putendl_fd(char *s, int fd)
16  {
17  	size_t	l;
18  
19  	if (!s)
20  		return ;
21  	l = 0;
22  	while (s[l])
23  		l++;
24  	write(fd, s, l);
25  	write(fd, "\n", 1);
26  }