add: read input
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/23 18:08:31 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/03 12:52:38 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/17 16:29:56 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -23,13 +23,13 @@ int ft_dprintarg(int fd, int arg, va_list args)
|
||||
if (arg == 'u')
|
||||
return (ft_dprintul(fd, va_arg(args, unsigned int)));
|
||||
if (arg == 'c')
|
||||
return (ft_putchar_fd(fd, va_arg(args, int)));
|
||||
return (ft_putchar_fd_p(fd, va_arg(args, int)));
|
||||
if (arg == 'S')
|
||||
return (ft_dprintstrtab(fd, va_arg(args, char **)));
|
||||
if (arg == 's')
|
||||
return (ft_putstr_fd_p(fd, va_arg(args, char *)));
|
||||
if (arg == '%')
|
||||
return (ft_putchar_fd(fd, '%'));
|
||||
return (ft_putchar_fd_p(fd, '%'));
|
||||
if (arg == 'p')
|
||||
return (ft_dprintptr(fd, va_arg(args, void *)));
|
||||
return (0);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/10 03:26:21 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/10/21 15:54:31 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/17 16:30:25 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -23,7 +23,7 @@ int ft_dprintl_base(int fd, long long int n, char *base)
|
||||
if (n < 0)
|
||||
{
|
||||
nb = -n;
|
||||
i += ft_putchar_fd(fd, '-');
|
||||
i += ft_putchar_fd_p(fd, '-');
|
||||
}
|
||||
else
|
||||
nb = n;
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/01/05 17:26:55 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/03 12:54:44 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/17 16:30:44 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -22,7 +22,7 @@ int ft_dprintstrtab(int fd, char **tab)
|
||||
while (tab[index] != NULL)
|
||||
{
|
||||
i += ft_putstr_fd_p(fd, tab[index]) + 1;
|
||||
ft_putchar_fd(fd, '\n');
|
||||
ft_putchar_fd_p(fd, '\n');
|
||||
index++;
|
||||
}
|
||||
return (i);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/09/29 13:49:45 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/10/23 14:23:44 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/17 16:31:15 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -73,9 +73,9 @@ int ft_dprintul_base(int fd, unsigned long long n, char *base)
|
||||
if (n > base_size - 1)
|
||||
{
|
||||
ft_dprintul_base(fd, n / base_size, base);
|
||||
ft_putchar_fd(fd, base[n % base_size]);
|
||||
ft_putchar_fd_p(fd, base[n % base_size]);
|
||||
}
|
||||
else
|
||||
ft_putchar_fd(fd, base[n]);
|
||||
ft_putchar_fd_p(fd, base[n]);
|
||||
return (str_size - 1);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/09/26 14:47:54 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/03 12:51:07 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/17 16:29:18 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -36,7 +36,7 @@ int ft_eprintf(const char *format, ...);
|
||||
|
||||
int ft_vdprintf(int fd, const char *format, va_list va);
|
||||
|
||||
int ft_putchar_fd(int fd, char c);
|
||||
int ft_putchar_fd_p(int fd, char c);
|
||||
int ft_putstr_fd_p(int fd, char *str);
|
||||
|
||||
#endif
|
||||
|
@ -6,13 +6,13 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/09/29 22:23:35 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/10/12 15:21:42 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/17 16:28:59 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_printf.h"
|
||||
|
||||
int ft_putchar_fd(int fd, char c)
|
||||
int ft_putchar_fd_p(int fd, char c)
|
||||
{
|
||||
write(fd, &c, 1);
|
||||
return (1);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/09/29 22:25:08 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/03 12:49:18 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/17 16:28:25 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -20,6 +20,6 @@ int ft_putstr_fd_p(int fd, char *str)
|
||||
str = "(null)";
|
||||
i = 0;
|
||||
while (str[i] != '\0')
|
||||
ft_putchar_fd(fd, str[i++]);
|
||||
ft_putchar_fd_p(fd, str[i++]);
|
||||
return (i);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/12 14:34:28 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/12/11 19:23:34 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/17 16:31:29 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -19,7 +19,7 @@ static int ft_dprintseg(int fd, const char *str)
|
||||
i = 0;
|
||||
while (str[i] != '\0' && ft_skipflag(str + i) == 0)
|
||||
{
|
||||
ft_putchar_fd(fd, str[i]);
|
||||
ft_putchar_fd_p(fd, str[i]);
|
||||
i++;
|
||||
}
|
||||
return (i);
|
||||
|
Reference in New Issue
Block a user