wip_parsing
This commit is contained in:
18
libft/put/ft_putchar_fd.c
Normal file
18
libft/put/ft_putchar_fd.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putchar_fd.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: madumerg <madumerg@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/03 14:32:56 by madumerg #+# #+# */
|
||||
/* Updated: 2023/11/03 14:52:19 by madumerg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void ft_putchar_fd(char c, int fd)
|
||||
{
|
||||
write(fd, &c, 1);
|
||||
}
|
28
libft/put/ft_putendl_fd.c
Normal file
28
libft/put/ft_putendl_fd.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putendl_fd.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: madumerg <madumerg@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/03 14:33:06 by madumerg #+# #+# */
|
||||
/* Updated: 2024/04/04 17:11:24 by madumerg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void ft_putendl_fd(char *s, int fd)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
if (!s)
|
||||
return ;
|
||||
while (s[i] != '\0')
|
||||
{
|
||||
write(fd, &s[i], 1);
|
||||
i++;
|
||||
}
|
||||
write(fd, "\n", 1);
|
||||
}
|
38
libft/put/ft_putnbr_fd.c
Normal file
38
libft/put/ft_putnbr_fd.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putnbr_fd.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: madumerg <madumerg@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/03 14:33:42 by madumerg #+# #+# */
|
||||
/* Updated: 2023/11/03 14:58:11 by madumerg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void ft_putnbr_fd(int n, int fd)
|
||||
{
|
||||
if (n == -2147483648)
|
||||
{
|
||||
ft_putchar_fd('-', fd);
|
||||
ft_putchar_fd('2', fd);
|
||||
n = 147483648;
|
||||
}
|
||||
if (n < 0)
|
||||
{
|
||||
ft_putchar_fd('-', fd);
|
||||
n *= -1;
|
||||
}
|
||||
if (n < 10)
|
||||
{
|
||||
ft_putchar_fd((n + '0'), fd);
|
||||
return ;
|
||||
}
|
||||
else if (n >= 10)
|
||||
{
|
||||
ft_putnbr_fd((n / 10), fd);
|
||||
ft_putnbr_fd((n % 10), fd);
|
||||
}
|
||||
}
|
27
libft/put/ft_putstr_fd.c
Normal file
27
libft/put/ft_putstr_fd.c
Normal file
@ -0,0 +1,27 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putstr_fd.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: madumerg <madumerg@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/03 14:33:15 by madumerg #+# #+# */
|
||||
/* Updated: 2023/11/09 16:26:33 by madumerg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void ft_putstr_fd(char *s, int fd)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
if (!s)
|
||||
return ;
|
||||
while (s[i] != '\0')
|
||||
{
|
||||
write(fd, &s[i], 1);
|
||||
i++;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user