I'm totally adding this to epic win. +300

This commit is contained in:
Tom Moron
2024-02-02 23:05:45 +01:00
parent 6a7d550a92
commit eea56ccef4
67 changed files with 2687 additions and 0 deletions

33
libft/ft_putnbr_fd.c Executable file
View File

@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/11 23:27:29 by tomoron #+# #+# */
/* Updated: 2023/11/01 14:06:01 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putnbr_fd(int nb, int fd)
{
if (nb >= 10)
{
ft_putnbr_fd(nb / 10, fd);
ft_putchar_fd((nb % 10) + 48, fd);
}
else if (nb < 0)
{
if (nb == -2147483648)
write(fd, "-2147483648", 11);
else
{
ft_putchar_fd('-', fd);
ft_putnbr_fd(nb * -1, fd);
}
}
else
ft_putchar_fd((nb % 10) + 48, fd);
}