42_ft_printf/ft_vdprintf.c

27 lines
1.1 KiB
C
Raw Normal View History

2022-10-06 20:30:03 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_vdprintf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/06 16:39:25 by cchauvet #+# #+# */
2022-10-10 13:33:47 -04:00
/* Updated: 2022/10/10 19:12:04 by cchauvet ### ########.fr */
2022-10-06 20:30:03 -04:00
/* */
/* ************************************************************************** */
2022-10-10 13:33:47 -04:00
#include "printf.h"
2022-10-06 20:30:03 -04:00
2022-10-10 13:33:47 -04:00
int ft_vdprintf(int fd, const char *format, va_list va)
2022-10-06 20:30:03 -04:00
{
char *str;
2022-10-10 13:33:47 -04:00
int rv;
2022-10-06 20:30:03 -04:00
str = ft_strdup("");
str = ft_vsprintf(str, format, va);
2022-10-10 13:33:47 -04:00
rv = ft_strlen(str);
2022-10-06 20:30:03 -04:00
ft_putstr_fd(str, fd);
2022-10-10 13:33:47 -04:00
free(str);
return (rv);
2022-10-06 20:30:03 -04:00
}