Projet de l'école 42 : Printf
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

58 lines
1.4 KiB

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchars.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/27 09:17:03 by narnaud #+# #+# */
/* Updated: 2021/11/17 09:57:53 by narnaud ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_putchar(int ch)
{
char c;
c = (char)ch;
write(1, &c, 1);
return (1);
}
int ft_putstr(char *str)
{
int i;
i = 0;
if (!str)
{
ft_putstr("(null)");
return (6);
}
while (str[i])
ft_putchar(str[i++]);
return (i);
}
int va_putchar(va_list va_ch, const char *str)
{
(void)*str;
ft_putchar(va_arg(va_ch, int));
return (1);
}
int va_putstr(va_list va_str, const char *str)
{
(void)*str;
return (ft_putstr(va_arg(va_str, char *)));
}
int va_putperc(va_list va, const char *str)
{
(void)*str;
(void)va;
ft_putchar('%');
return (1);
}