sync
This commit is contained in:
41
C_09/git/ex02/ft_split.c
Normal file
41
C_09/git/ex02/ft_split.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_split.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <gbaconni@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/22 18:14:04 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/22 18:30:07 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static int ft_strlen(char *str)
|
||||
{
|
||||
char *p_str;
|
||||
|
||||
p_str = str;
|
||||
while (*p_str != '\0')
|
||||
p_str++;
|
||||
return (p_str - str);
|
||||
}
|
||||
|
||||
char **ft_split(char *str, char *charset)
|
||||
{
|
||||
char *p_str;
|
||||
char **strs;
|
||||
int size;
|
||||
int r;
|
||||
|
||||
r = 1;
|
||||
p_str = str;
|
||||
while (p_str != '\0')
|
||||
{
|
||||
p_str++;
|
||||
}
|
||||
strs = (char **) malloc((size) * sizeof(char));
|
||||
return (strs);
|
||||
}
|
||||
33
C_09/git/ex02/main.c
Normal file
33
C_09/git/ex02/main.c
Normal file
@@ -0,0 +1,33 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <gbaconni@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/18 10:50:59 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/22 18:19:18 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
char **ft_split(char *str, char *charset);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char *str[32];
|
||||
char *charset[32];
|
||||
char **result;
|
||||
|
||||
printf("Input String [Max 32]: ");
|
||||
scanf("%s", str);
|
||||
printf("Input Charset [Max 32]: ");
|
||||
scanf("%s", charset);
|
||||
result = ft_split(str, charset);
|
||||
printf("str=%s charset=%s result=%s (ft_split)\n", str, charset, result);
|
||||
return (0);
|
||||
}
|
||||
9
C_09/git/ex02/main.sh
Executable file
9
C_09/git/ex02/main.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
rm -f a.out
|
||||
#norminette -R CheckForbiddenSourceHeader ft_*.c
|
||||
norminette -R CheckForbiddenSourceHeader
|
||||
gcc -Wall -Wextra -Werror -o a.out *.c
|
||||
echo $(basename $PWD):
|
||||
./a.out
|
||||
rm -f a.out
|
||||
Reference in New Issue
Block a user