maxishell
Implementation of a shell for Linux-like systems
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: rmikhayl <rmikhayl@student.42london.c +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2023/12/17 17:25:27 by rmikhayl #+# #+# */
9/* Updated: 2023/12/17 17:25:27 by rmikhayl ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include "libft.h"
14
15/* *************************** ft_putnbr_fd ********************************* */
16/* Writes the integer 'n' to the specified file descriptor 'fd'. */
17/* A file descriptor is a numeric identifier for an I/O resource. */
18/* ************************************************************************** */
19
20void ft_putnbr_fd(int n, int fd)
21{
22 if (n == -2147483648)
23 ft_putstr_fd("-2147483648", fd);
24 else
25 {
26 if (n < 0)
27 {
28 ft_putchar_fd('-', fd);
29 n = -n;
30 }
31 if (n >= 10)
32 ft_putnbr_fd(n / 10, fd);
33 ft_putchar_fd((n % 10) + '0', fd);
34 }
35}
void ft_putnbr_fd(int n, int fd)
void ft_putchar_fd(char c, int fd)
void ft_putstr_fd(char *s, int fd)