Browse Source

changed fprintf to use FILE

master
nicolas-arnaud 2 years ago
parent
commit
d2d5c969e8
  1. 1019
      compile_commands.json
  2. 3
      includes/ft_printf.h
  3. 4
      srcs/ft_printf.c

1019
compile_commands.json

File diff suppressed because it is too large

3
includes/ft_printf.h

@ -16,6 +16,7 @@
# include "libft.h" # include "libft.h"
# include <stdarg.h> # include <stdarg.h>
# include <stdio.h>
typedef struct s_opts { typedef struct s_opts {
int len; int len;
@ -54,5 +55,5 @@ void va_print_perc(va_list va, const char *str, t_opts *opts);
void ft_format(const char *str, va_list args); void ft_format(const char *str, va_list args);
int ft_printf(const char *str, ...); int ft_printf(const char *str, ...);
int ft_fprintf(int fd, const char *format, ...); int ft_fprintf(FILE *file, const char *format, ...);
int ft_sprintf(char *ret, const char *format, ...); int ft_sprintf(char *ret, const char *format, ...);

4
srcs/ft_printf.c

@ -117,7 +117,7 @@ int ft_printf(const char *format, ...)
return (ret); return (ret);
} }
int ft_fprintf(int fd, const char *format, ...) int ft_fprintf(FILE *file, const char *format, ...)
{ {
int ret; int ret;
t_dlist *strings; t_dlist *strings;
@ -130,7 +130,7 @@ int ft_fprintf(int fd, const char *format, ...)
while (strings) while (strings)
{ {
ret += strings->size; ret += strings->size;
ft_putnstr_fd(strings->size, strings->content, fd); fwrite(strings->content, sizeof(char), strings->size, file);
strings = strings->next; strings = strings->next;
} }
clean_list(); clean_list();

Loading…
Cancel
Save