ft_putstr_fd: initial implementation
This commit is contained in:
parent
28cadf55f1
commit
81343980be
3 changed files with 41 additions and 3 deletions
5
Makefile
5
Makefile
|
|
@ -6,7 +6,7 @@
|
|||
# By: kcolin <marvin@42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/10/14 13:43:59 by kcolin #+# #+# #
|
||||
# Updated: 2024/10/18 14:27:44 by kcolin ### ########.fr #
|
||||
# Updated: 2024/10/18 14:36:09 by kcolin ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
|
|
@ -42,7 +42,8 @@ SOURCES = ft_isalpha.c \
|
|||
ft_itoa.c \
|
||||
ft_strmapi.c \
|
||||
ft_striteri.c \
|
||||
ft_putchar_fd.c
|
||||
ft_putchar_fd.c \
|
||||
ft_putstr_fd.c
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
CC = gcc
|
||||
|
||||
|
|
|
|||
36
ft_putstr_fd.c
Normal file
36
ft_putstr_fd.c
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putstr_fd.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/18 14:33:21 by kcolin #+# #+# */
|
||||
/* Updated: 2024/10/18 15:17:57 by kcolin ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_putstr_fd(char *s, int fd)
|
||||
{
|
||||
write(fd, s, ft_strlen(s));
|
||||
}
|
||||
|
||||
/*
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc > 1)
|
||||
{
|
||||
int i = 1;
|
||||
while (i < argc)
|
||||
{
|
||||
ft_putstr_fd(argv[i], 1);
|
||||
ft_putchar_fd('\n', 1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
*/
|
||||
3
libft.h
3
libft.h
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/15 10:11:54 by kcolin #+# #+# */
|
||||
/* Updated: 2024/10/18 11:33:58 by kcolin ### ########.fr */
|
||||
/* Updated: 2024/10/18 15:20:07 by kcolin ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -58,5 +58,6 @@ char *ft_strmapi(char const *s, char (*f)(unsigned int, char));
|
|||
void ft_striteri(char *s, void (*f)(unsigned int, char*));
|
||||
|
||||
void ft_putchar_fd(char c, int fd);
|
||||
void ft_putstr_fd(char *s, int fd);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue