Browse Source

added ft_putnstr_fd

master
nicolas-arnaud 2 years ago
parent
commit
824c048555
  1. 2
      Makefile
  2. 2
      libft.h
  3. 21
      put/ft_putnstr_fd.c

2
Makefile

@ -16,7 +16,7 @@ SRCS += mem/ft_bzero.c mem/ft_memset.c mem/ft_memchr.c mem/ft_memcpy.c \
mem/ft_memcmp.c mem/ft_memmove.c mem/ft_calloc.c mem/ft_free_split.c mem/ft_memcmp.c mem/ft_memmove.c mem/ft_calloc.c mem/ft_free_split.c
SRCS += put/ft_putchar_fd.c put/ft_putnbr_fd.c put/ft_putendl_fd.c \ SRCS += put/ft_putchar_fd.c put/ft_putnbr_fd.c put/ft_putendl_fd.c \
put/ft_putstr_fd.c put/ft_putstr_fd.c put/ft_putnstr_fd.c
SRCS += nbr/ft_nbrlen.c nbr/ft_croissant.c nbr/ft_decroissant.c nbr/ft_max.c \ SRCS += nbr/ft_nbrlen.c nbr/ft_croissant.c nbr/ft_decroissant.c nbr/ft_max.c \
nbr/ft_min.c nbr/ft_min.c

2
libft.h

@ -31,6 +31,7 @@ typedef struct s_i_slist
typedef struct s_dlist typedef struct s_dlist
{ {
void *content; void *content;
size_t size;
struct s_dlist *next; struct s_dlist *next;
struct s_dlist *previous; struct s_dlist *previous;
} t_dlist; } t_dlist;
@ -84,6 +85,7 @@ char *ft_strmapi(char const *s, char (*f)(unsigned int, char));
void ft_striteri(char *s, void (*f)(unsigned int, char*)); void ft_striteri(char *s, void (*f)(unsigned int, char*));
void ft_putchar_fd(char c, int fd); void ft_putchar_fd(char c, int fd);
void ft_putstr_fd(char *s, int fd); void ft_putstr_fd(char *s, int fd);
void ft_putnstr_fd(size_t n, char *s, int fd);
void ft_putendl_fd(char *s, int fd); void ft_putendl_fd(char *s, int fd);
void ft_putnbr_fd(int n, int fd); void ft_putnbr_fd(int n, int fd);
char *ft_append(char *s1, char *s2); char *ft_append(char *s1, char *s2);

21
put/ft_putnstr_fd.c

@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/22 15:10:39 by narnaud #+# #+# */
/* Updated: 2022/03/24 09:22:49 by narnaud ### ########.fr */
/* */
/* ************************************************************************** */
#include "../libft.h"
void ft_putnstr_fd(size_t n, char *s, int fd)
{
if (!s)
return ;
while (n--)
ft_putchar_fd(*(s++), fd);
}
Loading…
Cancel
Save