-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putnbrerrno.c
executable file
·35 lines (33 loc) · 1.19 KB
/
ft_putnbrerrno.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_putnbrerrno.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: luperez <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/05 19:38:36 by luperez #+# #+# */
/* Updated: 2014/11/29 21:22:48 by luperez ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putnbrerrno(int nbr)
{
if (nbr < 0)
{
if (nbr == -2147483648)
{
ft_putstrerrno("-2147483648");
return ;
}
ft_putcharerrno('-');
nbr = -1 * nbr;
}
if (nbr / 10 > 0)
ft_putnbr(nbr / 10);
else
{
ft_putcharerrno(nbr + '0');
return ;
}
ft_putcharerrno(nbr % 10 + '0');
}