-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putendl_fd.c
executable file
·38 lines (33 loc) · 1.18 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
34
35
36
37
38
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putendl_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: skarunat <skarunat@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/01/26 17:16:43 by skarunat #+# #+# */
/* Updated: 2023/08/05 18:23:05 by skarunat ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void ft_putchar_fd(char c, int fd)
{
write(fd, &c, sizeof(c));
}
void ft_putstr_fd(const char *str, int fd)
{
int i;
i = 0;
while (str[i])
{
write(fd, &str[i++], 1);
}
}
void ft_putendl_fd(char *str, int fd)
{
if (str)
{
ft_putstr_fd(str, fd);
ft_putchar_fd('\n', fd);
}
}