Libft
42 Libft library documentation
Loading...
Searching...
No Matches
ft_putnbr_fd.c File Reference
+ Include dependency graph for ft_putnbr_fd.c:

Go to the source code of this file.

Functions

void ft_putnbr_fd (int n, int fd)
 Writes an integer in decimal format to a file descriptor.
 

Function Documentation

◆ ft_putnbr_fd()

void ft_putnbr_fd ( int  n,
int  fd 
)

Writes an integer in decimal format to a file descriptor.

Handles negative values and the full int range.

Parameters
nValue to write.
fdDestination file descriptor.

Definition at line 23 of file ft_putnbr_fd.c.

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.

References ft_putchar_fd(), and ft_putnbr_fd().

Referenced by ft_putnbr_fd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: