-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putlong_fd.c
27 lines (25 loc) · 1.09 KB
/
ft_putlong_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putlong_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: malexand <malexand@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/15 15:31:56 by skyzie #+# #+# */
/* Updated: 2017/02/16 17:34:26 by malexand ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putlong_fd(long n, int fd)
{
if (n < 0)
{
ft_putchar_fd('-', fd);
n = -n;
}
if (n == 0)
ft_putchar_fd('0', fd);
if (n / 10)
ft_putlong_fd(n / 10, fd);
ft_putchar_fd(n % 10 + '0', fd);
}