libft
src
ft_putnbr_fd.c
Go to the documentation of this file.
1
/* ************************************************************************** */
3
/* */
4
/* ::: :::::::: */
5
/* ft_putnbr_fd.c :+: :+: :+: */
6
/* +:+ +:+ +:+ */
7
/* By: unite <marvin@42.fr> +#+ +:+ +#+ */
8
/* +#+#+#+#+#+ +#+ */
9
/* Created: 2019/09/05 14:59:38 by unite #+# #+# */
10
/* Updated: 2020/07/16 02:54:15 by unite ### ########.fr */
11
/* */
12
/* ************************************************************************** */
13
14
#include "
libft.h
"
15
#include <limits.h>
16
23
void
ft_putnbr_fd
(
int
n,
int
fd)
24
{
25
if
(n == INT_MIN)
26
{
27
ft_putnbr_fd
(n / 10, fd);
28
ft_putnbr_fd
(-(n % 10), fd);
29
}
30
else
if
(n < 0)
31
{
32
ft_putchar_fd
(
'-'
, fd);
33
ft_putnbr_fd
(-n, fd);
34
}
35
else
if
(n > 9)
36
{
37
ft_putnbr_fd
(n / 10, fd);
38
ft_putchar_fd
(n % 10 +
'0'
, fd);
39
}
40
else
41
ft_putchar_fd
(n % 10 +
'0'
, fd);
42
}
ft_putnbr_fd
void ft_putnbr_fd(int n, int fd)
Writes an integer to a file descriptor.
Definition:
ft_putnbr_fd.c:23
libft.h
ft_putchar_fd
void ft_putchar_fd(char c, int fd)
Writes a character to a file descriptor.
Definition:
ft_putchar_fd.c:23
Generated by
1.8.16