-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putendl.c
27 lines (24 loc) · 1.12 KB
/
ft_putendl.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putendl.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mfebvay <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2013/11/19 14:01:54 by mfebvay #+# #+# */
/* Updated: 2014/03/15 17:06:50 by mfebvay ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
int ft_putendl(char const *s)
{
int len;
if (!s)
return ((int)write(1, "(null)\n", 7));
len = 0;
while (s[len])
len++;
if ((len = (int)write(1, s, len)) == -1)
return (len);
return (len + (int)write(1, "\n", 1));
}