-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putendl.c
28 lines (25 loc) · 1.14 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
28
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putendl.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thifranc <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/02/16 09:16:49 by thifranc #+# #+# */
/* Updated: 2016/04/28 11:33:34 by thifranc ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putendl(char const *s)
{
char *out;
int len;
len = ft_strlen(s);
if (!(out = (char*)malloc(sizeof(char) * (len + 2))))
return ;
ft_strcpy(out, s);
out[len] = '\n';
out[len + 1] = '\0';
write(1, out, len + 2);
ft_memdel((void**)&out);
}