drawio done and at norm
This commit is contained in:
@@ -64,6 +64,7 @@ void ft_bzero(void *s, size_t n);
|
||||
|
||||
char **ft_split(const char *s, char *set);
|
||||
char **ft_split_keep(const char *s, char *set);
|
||||
char *ft_tabstr(char **tab);
|
||||
int is_charset(char c, char *set);
|
||||
void free_tab(char **tab);
|
||||
char **free_all(char **tab, int count);
|
||||
|
||||
36
lib/libft/srcs/format/ft_tabstr.c
Normal file
36
lib/libft/srcs/format/ft_tabstr.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_tabstr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/29 08:54:00 by nalebrun #+# #+# */
|
||||
/* Updated: 2025/01/29 08:54:00 by nalebrun ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../libft.h"
|
||||
|
||||
char *ft_tabstr(char **tab)
|
||||
{
|
||||
int i;
|
||||
int alloc_count;
|
||||
char *out;
|
||||
char *tmp;
|
||||
|
||||
i = -1;
|
||||
alloc_count = 0;
|
||||
while (tab[++i])
|
||||
alloc_count += ft_strlen(tab[i]) + 1;
|
||||
i = 0;
|
||||
out = tab[0];
|
||||
while (tab[++i])
|
||||
{
|
||||
tmp = out;
|
||||
out = ft_sprintf("%s %s", out, tab[i]);
|
||||
free(tmp);
|
||||
}
|
||||
out[alloc_count] = 0;
|
||||
return (out);
|
||||
}
|
||||
Reference in New Issue
Block a user