Help
This commit is contained in:
parent
4ffaf6a61f
commit
3a9d944f74
|
@ -6,7 +6,7 @@
|
|||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/03/08 20:08:33 by erey-bet #+# #+# */
|
||||
/* Updated: 2023/03/24 16:38:39 by erey-bet ### ########.fr */
|
||||
/* Updated: 2023/03/25 00:17:08 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -40,7 +40,7 @@ void message(int id, char *msg)
|
|||
all = ft_calloc(ft_strlen(id_str) + ft_strlen(msg) + ft_strlen(time) + 1, 1);
|
||||
i = -1;
|
||||
while (time[++i])
|
||||
all[i] = id_str[i];
|
||||
all[i] = time[i];
|
||||
while (id_str[++i - ft_strlen(time)])
|
||||
all[i] = id_str[i - ft_strlen(time)];
|
||||
while (msg[++i - ft_strlen(time) - ft_strlen(id_str)])
|
||||
|
@ -170,7 +170,10 @@ t_philo *init_philo(t_same *same, t_only *only)
|
|||
|
||||
int manage_threads(t_config *config)
|
||||
{
|
||||
pthread_t *threads;
|
||||
(void)config;
|
||||
message(1, "testfuck\n");
|
||||
return (0);
|
||||
/*pthread_t *threads;
|
||||
t_same *same;
|
||||
int i;
|
||||
|
||||
|
@ -196,5 +199,5 @@ int manage_threads(t_config *config)
|
|||
}
|
||||
}
|
||||
destroy_mutex(same->mutex, 3);
|
||||
return (0);
|
||||
return (0);*/
|
||||
}
|
||||
|
|
|
@ -19,11 +19,20 @@ char *ft_itoa(long long n)
|
|||
long long i;
|
||||
|
||||
q = 10;
|
||||
while (n / q > 0)
|
||||
q = q * 10;
|
||||
str = malloc(sizeof(char) * q + 1);
|
||||
i = 0;
|
||||
while (q > 0)
|
||||
while (n / q > 0)
|
||||
{
|
||||
q = q * 10;
|
||||
i++;
|
||||
}
|
||||
str = malloc(sizeof(char) * i + 1);
|
||||
if (!str)
|
||||
return (NULL);
|
||||
i = 0;
|
||||
while (q > 1)
|
||||
{;
|
||||
str[i++] = (n / q % 10) + 48;
|
||||
q = q / 10;
|
||||
}
|
||||
return (str);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue