This commit is contained in:
Timo Schmidt 2023-03-21 07:28:41 +01:00
parent e0eeb8dee5
commit dc014441bc
5 changed files with 111 additions and 5 deletions

View File

@ -6,7 +6,7 @@
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/19 11:18:13 by tischmid #+# #+# */
/* Updated: 2023/03/19 11:23:14 by tischmid ### ########.fr */
/* Updated: 2023/03/19 11:25:38 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
@ -21,7 +21,7 @@ char *ft_strupcase(char *str)
return (str);
}
#define START
/* ////
#include <stdio.h>
int main(void)
@ -33,3 +33,4 @@ int main(void)
printf("%s\n", s2);
return (0);
}
*/ ////

View File

@ -6,7 +6,7 @@
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/19 11:27:43 by tischmid #+# #+# */
/* Updated: 2023/03/19 11:48:17 by tischmid ### ########.fr */
/* Updated: 2023/03/19 11:48:58 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
@ -44,7 +44,7 @@ char *ft_strcapitalize(char *str)
int main(void)
{
char s1[] = "hallo mein name ist timo und das ist ein 13371G3R TEXT hier";
char s1[] = "salut, comment tu vas ? 42mots quarante-deux; cinquante+et+un";
char *s2;
s2 = ft_strcapitalize(s1);
printf("%s\n", s2);

View File

@ -6,15 +6,31 @@
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/19 11:49:46 by tischmid #+# #+# */
/* Updated: 2023/03/19 11:59:21 by tischmid ### ########.fr */
/* Updated: 2023/03/21 00:48:06 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
unsigned int ft_strlcpy(char *dest, char *src, unsigned int size)
{
unsigned int i;
i = -1;
while (*src && ++i < size - 1)
*dest++ = *src++;
*dest = 0;
return (i);
}
/* ////
#include <stdio.h>
int main(void)
{
char buf[BUFSIZ];
char str[] = {'A','B','C','D','E','\0'};
ft_strlcpy(buf, str, 5);
printf("%s\n", buf);
return (0);
}
*/ ////

View File

@ -0,0 +1,54 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr_non_printable.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/21 02:59:50 by tischmid #+# #+# */
/* Updated: 2023/03/21 03:10:35 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putstr_non_printable(char *str)
{
char first_digit;
char second_digit;
while (*str)
{
if (*str < 32)
{
first_digit = "0123456789abcdef"[*str / 16];
second_digit = "0123456789abcdef"[*str % 16];
write(1, "\\", 1);
write(1, &first_digit, 1);
write(1, &second_digit, 1);
}
else
{
write(1, str, 1);
}
++str;
}
}
/* ////
#include <stdio.h>
int main(void)
{
char s1[200];
int i;
for (i = 0; i < 127; ++i)
{
s1[i] = i + 1;
}
s1[i] = 0;
ft_putstr_non_printable(s1);
return (0);
}
*/ ////

35
ex12/ft_print_memory.c Normal file
View File

@ -0,0 +1,35 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_memory.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/21 05:44:01 by tischmid #+# #+# */
/* Updated: 2023/03/21 06:43:18 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void *ft_print_memory(void *addr, unsigned int size)
{
return (addr);
}
/* ////
#include <stdio.h>
int main(void)
{
char s[] = "0123456789abcdef0123456789abcdefghijklmnopqrstuvwxyz";
ft_print_memory(s, 20);
return (0);
}
*/ ////