-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putendl_fd.c
executable file
·33 lines (29 loc) · 1.14 KB
/
ft_putendl_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putendl_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mwilliam <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/11 12:11:21 by mwilliam #+# #+# */
/* Updated: 2016/11/14 08:52:12 by mwilliam ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
** Outputs the string s to the file descriptor fd followed by a '\n'
*/
void ft_putendl_fd(char const *s, int fd)
{
int index;
index = 0;
if (s)
{
while (s[index] != '\0')
{
write(fd, &s[index], 1);
index++;
}
}
write(fd, "\n", 1);
}