-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putstr_fd.c
39 lines (34 loc) · 1.18 KB
/
ft_putstr_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
34
35
36
37
38
39
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sizerese <sizerese@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/30 17:31:40 by sizerese #+# #+# */
/* Updated: 2023/08/03 23:45:50 by sizerese ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putstr_fd(char *s, int fd)
{
int i;
i = 0;
if (!s)
return ;
while (s[i])
{
write(fd, &s[i], 1);
i++;
}
}
/*
#include <fcntl.h>
int main(void)
{
char str[] = "hello there##";
int fd;
fd = open("string.txt", O_WRONLY | O_CREAT | O_TRUNC, 0777);
ft_putstr_fd(str, fd);
}
*/