49 lines
1.3 KiB
C
49 lines
1.3 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_show_tab.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2022/07/27 18:54:39 by cchauvet #+# #+# */
|
||
|
/* Updated: 2022/07/28 10:20:01 by cchauvet ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include <unistd.h>
|
||
|
|
||
|
void ft_putchar(char c)
|
||
|
{
|
||
|
write(1, &c, 1);
|
||
|
}
|
||
|
|
||
|
void ft_print_str(char *str)
|
||
|
{
|
||
|
while (*str != 0)
|
||
|
write(1, str++, 1);
|
||
|
ft_putchar('\n');
|
||
|
}
|
||
|
|
||
|
void ft_print_nbr(int nbr)
|
||
|
{
|
||
|
if (nbr > 9)
|
||
|
{
|
||
|
ft_print_nbr(nbr / 10);
|
||
|
ft_print_nbr(nbr % 10);
|
||
|
}
|
||
|
else
|
||
|
ft_putchar(nbr + 48);
|
||
|
}
|
||
|
|
||
|
void ft_show_tab(struct s_stock_str *par)
|
||
|
{
|
||
|
while (par->str[0] != 0)
|
||
|
{
|
||
|
ft_print_str(par->str);
|
||
|
ft_print_nbr(par->size);
|
||
|
ft_putchar('\n');
|
||
|
ft_print_str(par->copy);
|
||
|
par++;
|
||
|
}
|
||
|
}
|