-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putendl_fd.c
42 lines (36 loc) · 1.46 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
39
40
41
42
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putendl_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: edetoh <edetoh@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/19 16:34:23 by edetoh #+# #+# */
/* Updated: 2024/10/25 11:15:44 by edetoh ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
ft_putendl_fd writes the string 's' followed by an '\n' to 'fd'.
Takes 's' (string to write) and 'fd' (file descriptor).
Uses write() to write the string and the '\n'.
*/
void ft_putendl_fd(char *s, int fd)
{
int str_len;
str_len = ft_strlen(s);
write(fd, s, str_len);
write(fd, "\n", 1);
}
// #include <string.h>
// #include <stdio.h>
// #include <unistd.h>
// int main(int argc, char **argv)
// {
// (void)argc;
// (void)argv;
// printf("===== RESULT Putstr fd =====\n");
// ft_putendl_fd("123", 1);
// printf("=============================\n");
// return (1);
// }