-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf_d.c
More file actions
40 lines (35 loc) · 1.29 KB
/
ft_printf_d.c
File metadata and controls
40 lines (35 loc) · 1.29 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_d.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sabahass <sabahass@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/19 12:05:00 by sabahass #+# #+# */
/* Updated: 2025/10/21 18:59:13 by sabahass ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_print_d(int n)
{
char *str;
int i;
// ssize_t w;
str = ft_itoa(n);
if (!str)
return (-1);
i = ft_strlen(str);
if (write(1, str, i) == -1)
return (free(str), -1);
return (free(str), i);
// while (str[i])
// {
// w = write(1, &str[i], 1);
// if (w != 1)
// return (free(str), -1);
// i++;
// }
// free(str);
// return (i);
}
// putnbr linken/ gebruik logic van putnumber