50 lines
1.4 KiB
C
50 lines
1.4 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_show_tab.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2022/07/27 18:54:39 by cchauvet #+# #+# */
|
||
|
/* Updated: 2022/08/03 17:28:11 by cchauvet ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include <unistd.h>
|
||
|
#include "ft_stock_str.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++;
|
||
|
}
|
||
|
}
|