correct putstr_fd
This commit is contained in:
4
Makefile
4
Makefile
@ -6,7 +6,7 @@
|
|||||||
# By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ #
|
# By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2023/11/01 11:03:22 by adjoly #+# #+# #
|
# Created: 2023/11/01 11:03:22 by adjoly #+# #+# #
|
||||||
# Updated: 2023/11/05 10:48:31 by adjoly ### ########.fr #
|
# Updated: 2023/11/05 14:57:25 by adjoly ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
@ -20,6 +20,7 @@ SRCS = ft_atoi.c \
|
|||||||
ft_isalpha.c \
|
ft_isalpha.c \
|
||||||
ft_isascii.c \
|
ft_isascii.c \
|
||||||
ft_isdigit.c \
|
ft_isdigit.c \
|
||||||
|
ft_isprint.c \
|
||||||
ft_putchar_fd.c \
|
ft_putchar_fd.c \
|
||||||
ft_putnbr_fd.c \
|
ft_putnbr_fd.c \
|
||||||
ft_putstr_fd.c \
|
ft_putstr_fd.c \
|
||||||
@ -34,6 +35,7 @@ SRCS = ft_atoi.c \
|
|||||||
ft_strlcat.c \
|
ft_strlcat.c \
|
||||||
ft_strjoin.c \
|
ft_strjoin.c \
|
||||||
ft_strncmp.c \
|
ft_strncmp.c \
|
||||||
|
ft_strchr.c \
|
||||||
|
|
||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
|
|
||||||
|
18
ft_isprint.c
Normal file
18
ft_isprint.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_isprint.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/05 14:47:49 by adjoly #+# #+# */
|
||||||
|
/* Updated: 2023/11/05 14:51:51 by adjoly ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
int ft_isprint(int c)
|
||||||
|
{
|
||||||
|
if (c >= 32 && c <= 126)
|
||||||
|
return (1);
|
||||||
|
return (0);
|
||||||
|
}
|
18
ft_memchr.c
Normal file
18
ft_memchr.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_memchr.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/05 14:52:53 by adjoly #+# #+# */
|
||||||
|
/* Updated: 2023/11/05 14:54:57 by adjoly ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void *ft_memchr(const void *s, int c, size_t n)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/11/03 15:04:04 by adjoly #+# #+# */
|
/* Created: 2023/11/03 15:04:04 by adjoly #+# #+# */
|
||||||
/* Updated: 2023/11/03 15:57:15 by adjoly ### ########.fr */
|
/* Updated: 2023/11/05 14:52:24 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/10/31 11:45:55 by adjoly #+# #+# */
|
/* Created: 2023/10/31 11:45:55 by adjoly #+# #+# */
|
||||||
/* Updated: 2023/11/01 17:14:02 by adjoly ### ########.fr */
|
/* Updated: 2023/11/05 15:06:13 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -17,6 +17,8 @@ void ft_putstr_fd(char *s, int fd)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
if (s == NULL)
|
||||||
|
return ;
|
||||||
while (s[i])
|
while (s[i])
|
||||||
{
|
{
|
||||||
write(fd, &s[i], 1);
|
write(fd, &s[i], 1);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/11/01 15:45:18 by adjoly #+# #+# */
|
/* Created: 2023/11/01 15:45:18 by adjoly #+# #+# */
|
||||||
/* Updated: 2023/11/04 15:32:14 by adjoly ### ########.fr */
|
/* Updated: 2023/11/05 14:59:50 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -15,9 +15,10 @@ char *ft_strchr(const char *s, int c)
|
|||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
char *str_result;
|
char *str_result;
|
||||||
// initialize str_result
|
|
||||||
i = 0;
|
i = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
|
str_result = 0;
|
||||||
while (s[i] != c || s[i])
|
while (s[i] != c || s[i])
|
||||||
i++;
|
i++;
|
||||||
if (s[i] == c)
|
if (s[i] == c)
|
||||||
|
23
ft_strncmp.c
Normal file
23
ft_strncmp.c
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strncmp.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/05 10:40:45 by adjoly #+# #+# */
|
||||||
|
/* Updated: 2023/11/05 11:02:33 by adjoly ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_strncmp(const char *s1, const char *s2, size_t n)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (s1[i] && s2[i] && i < n && s1[i] != s2[i])
|
||||||
|
i++;
|
||||||
|
return (s1[i] - s2[i]);
|
||||||
|
}
|
5
libft.h
5
libft.h
@ -6,13 +6,14 @@
|
|||||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/11/01 10:06:03 by adjoly #+# #+# */
|
/* Created: 2023/11/01 10:06:03 by adjoly #+# #+# */
|
||||||
/* Updated: 2023/11/05 10:48:55 by adjoly ### ########.fr */
|
/* Updated: 2023/11/05 14:57:55 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef LIBFT_H
|
#ifndef LIBFT_H
|
||||||
# define LIBFT_H
|
# define LIBFT_H
|
||||||
|
|
||||||
|
#include <complex.h>
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
@ -40,5 +41,7 @@ int ft_toupper(int c);
|
|||||||
size_t ft_strlcat(char *dst, const char *src, size_t size);
|
size_t ft_strlcat(char *dst, const char *src, size_t size);
|
||||||
char *ft_strjoin(char const *s1, char const *s2);
|
char *ft_strjoin(char const *s1, char const *s2);
|
||||||
int ft_strncmp(const char *s1, const char *s2, size_t n);
|
int ft_strncmp(const char *s1, const char *s2, size_t n);
|
||||||
|
int ft_isprint(int c);
|
||||||
|
void *memchr(const void *s, int c, size_t n);
|
||||||
|
|
||||||
#endif
|
#endif
|
Reference in New Issue
Block a user