Libft
42 Libft library documentation
Loading...
Searching...
No Matches
ft_putnbr_fd.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* ft_putnbr_fd.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: raphalme <raphalme@student.42.fr> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/12/29 19:12:00 by raphalme #+# #+# */
9/* Updated: 2026/04/14 10:45:22 by raphalme ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include "../includes/libft.h"
14
23void ft_putnbr_fd(int n, int fd)
24{
25 long nb;
26
27 nb = n;
28 if (nb < 0)
29 {
30 ft_putchar_fd('-', fd);
31 nb = -nb;
32 }
33 if (nb >= 10)
34 ft_putnbr_fd(nb / 10, fd);
35 ft_putchar_fd((nb % 10) + '0', fd);
36}
void ft_putnbr_fd(int n, int fd)
Writes an integer in decimal format to a file descriptor.
void ft_putchar_fd(char c, int fd)
Writes one character to a file descriptor.