This commit is contained in:
Camille Chauvet
2023-05-17 16:45:25 +00:00
commit 29ed24d567
619 changed files with 16119 additions and 0 deletions

View File

@ -0,0 +1,41 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr_non_printable.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thellego <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 15:54:18 by thellego #+# #+# */
/* Updated: 2022/07/18 22:39:25 by thellego ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_printhexa(int i)
{
int nb;
nb = i / 16;
write(1, "\\", 1);
write(1, &"0123456789abcdef"[nb % 16], 1);
write(1, &"0123456789abcdef"[i % 16], 1);
}
void ft_putstr_non_printable(char *str)
{
int i;
i = 0;
while (str[i])
{
if (str[i] >= 32 && str[i] <= 126)
write(1, &str[i], 1);
else
ft_printhexa(str[i]);
i++;
}
}
/*int main(void){
ft_putstr_non_printable("Coucou\ntu vas bien ?");
}*/