-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putchar_fd.c
28 lines (26 loc) · 1.12 KB
/
ft_putchar_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: oelbouha <oelbouha@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/02 19:06:52 by oelbouha #+# #+# */
/* Updated: 2022/10/16 18:54:45 by oelbouha ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putchar_fd(char c, int fd)
{
write(fd, &c, 1);
}
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main()
{
int fd = open("file1", O_CREAT | O_RDWR);
ft_putchar_fd('h', fd);
printf("%d", fd);
close(fd);
}