mirror of
https://github.com/DavidGailleton/42-ft_printf.git
synced 2026-11-01 11:42:03 +01:00
Add write error management
This commit is contained in:
1 parent
56c3d8ba94
commit
620054c92e
4 files changed
+21
-10
No files matched your search
@@ -6,7 +6,7 @@
|
||||
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/11/17 12:16:44 by dgaillet #+# #+# */
|
||||
/* Updated: 2025/11/17 12:43:17 by dgaillet ### ########lyon.fr */
|
||||
/* Updated: 2025/11/21 14:49:36 by dgaillet ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -14,11 +14,14 @@
|
||||
|
||||
int ft_putnbr_base(unsigned long long nbr, char *base, int base_size)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
char temp;
|
||||
|
||||
if (nbr == 0)
|
||||
return (0);
|
||||
i = 1 + ft_putnbr_base(nbr / base_size, base, base_size);
|
||||
ft_putchar_fd(base[nbr % base_size], 1);
|
||||
temp = base[nbr % base_size];
|
||||
if (write(1, &temp, 1) < 0)
|
||||
return (-10000);
|
||||
return (i);
|
||||
}
|
||||
Reference in new issue
Block a user