-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putnbr_pf.c
39 lines (34 loc) · 1.16 KB
/
ft_putnbr_pf.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_pf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rahidalg <rahidalg@student.42madrid.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/02 19:20:37 by rahidalg #+# #+# */
/* Updated: 2024/05/02 19:32:41 by rahidalg ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
#include <fcntl.h>
#include <limits.h>
static int ft_nbrlen(int n)
{
size_t i;
i = 0;
if (n == 0)
return (1);
else if (n < 0)
i++;
while (n)
{
n /= 10;
i++;
}
return (i);
}
int ft_putnbr_pf(int n, int fd)
{
ft_putnbr_fd(n, fd);
return (ft_nbrlen(n));
}