minishell
ft_putstr_fd.c
Go to the documentation of this file.
1 /* ************************************************************************** */
2 /* */
3 /* ::: :::::::: */
4 /* ft_putstr_fd.c :+: :+: :+: */
5 /* +:+ +:+ +:+ */
6 /* By: kfujita <kfujita@student.42tokyo.jp> +#+ +:+ +#+ */
7 /* +#+#+#+#+#+ +#+ */
8 /* Created: 2022/04/19 07:57:56 by kfujita #+# #+# */
9 /* Updated: 2022/04/26 00:13:47 by kfujita ### ########.fr */
10 /* */
11 /* ************************************************************************** */
12 
13 #include <unistd.h>
14 #include <limits.h>
15 #include "../ft_string/ft_string.h"
16 
17 void ft_putstr_fd(char *s, int fd)
18 {
19  size_t length;
20 
21  if (s == NULL)
22  return ;
23  while (*s != '\0')
24  {
25  length = ft_strnlen(s, INT_MAX);
26  write(fd, s, length);
27  s += length;
28  }
29 }
void ft_putstr_fd(char *s, int fd)
Definition: ft_putstr_fd.c:17
size_t ft_strnlen(const char *str, size_t max_len)
Definition: ft_strnlen.c:16