-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_putstr_fd.c
More file actions
41 lines (39 loc) · 1.22 KB
/
Copy pathft_putstr_fd.c
File metadata and controls
41 lines (39 loc) · 1.22 KB
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
36
37
38
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yelallam <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/27 09:14:24 by yelallam #+# #+# */
/* Updated: 2025/11/30 21:33:36 by yelallam ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_putstr_fd(char *s, int fd)
{
int i;
int count;
i = 0;
count = 0;
if (!s)
{
write(1, "(null)", 6);
return (6);
}
if (s[i] == '\0')
return (0);
while (s[i])
{
count += ft_putchar_fd(s[i], fd);
i++;
}
return (count);
}
/*int main()
{
int i;
char *s = NULL;
i = ft_putstr_fd(s, 1);
printf("%d\n", i);
}*/