-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_write_fd.c
27 lines (24 loc) · 1.12 KB
/
ft_write_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_write_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thifranc <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/02/16 09:40:39 by thifranc #+# #+# */
/* Updated: 2016/05/01 14:58:17 by thifranc ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_write_fd(char *s, int fd)
{
char *out;
int len;
len = ft_strlen(s);
if (!(out = (char*)malloc(sizeof(char) * (len + 1))))
return ;
ft_strcpy(out, s);
out[len] = '\n';
write(fd, out, len + 1);
ft_memdel((void**)&out);
}