-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_ft_putnbr_fd.c
40 lines (37 loc) · 1.42 KB
/
test_ft_putnbr_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test_ft_putnbr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jliew <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/07 13:47:23 by jliew #+# #+# */
/* Updated: 2020/07/09 23:20:55 by jliew ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <fcntl.h>
#include "libft.h"
int main(int argc, char **argv)
{
if (argc == 1)
{
printf("-----------------------------------\n");
printf(" void ft_putnbr_fd(int nb, int fd)\n");
printf("-----------------------------------\n");
printf("usage [manual]:\n");
printf("1. a <int nb>\n");
}
else
{
int nb;
int fd;
nb = atoi(argv[1]);
fd = open("42", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
if (fd == -1)
printf("open failed\n");
ft_putnbr_fd(nb, fd);
if (close(fd) == -1)
printf("close failed\n");
}
}