-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putstr_fd.c
35 lines (30 loc) · 1.42 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mbrito-p <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/08 20:27:03 by mbrito-p #+# #+# */
/* Updated: 2023/05/08 20:27:03 by mbrito-p ### ########.fr */
/* */
/* ************************************************************************** */
// Outputs the string ’s’ to the given file
// descriptor.
#include "libft.h"
void ft_putstr_fd(char *s, int fd)
{
if(!s)
return ;
write(fd, s, ft_strlen(s));
// fd is the file descriptor to write to,
// s is a pointer to the buffer to write from,
// and ft_strlen(s) is the number of bytes to write.
}
// int main(void)
// {
// char *str = "Hello, world!";
// int fd = 1; // File descriptor for standard output (i.e., the terminal)
// ft_putstr_fd(str, fd);
// return 0;
// }