-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putstr_fd.c
35 lines (32 loc) · 1.2 KB
/
ft_putstr_fd.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: szerisen <szerisen@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/04 20:25:29 by szerisen #+# #+# */
/* Updated: 2023/01/08 20:25:29 by szerisen ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_putstr_fd(char *s, int fd, size_t *ret, size_t *i)
{
size_t x;
size_t l;
char *nl;
x = 0;
*i = *i + 1;
nl = "(null)";
if (s == NULL)
{
while (x < 6)
ft_putchar_fd(nl[x++], fd, ret);
return ;
}
if (!s)
return ;
l = ft_strlen(s);
while (x < l)
ft_putchar_fd(s[x++], fd, ret);
}