minus and 0 flags WIP

This commit is contained in:
David Gailleton
2025-11-19 21:02:04 +01:00
parent 66878549eb
commit bd1c66d86f
15 changed files with 317 additions and 57 deletions

42
bonus/utils_flag_bonus.c Normal file
View File

@@ -0,0 +1,42 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils_flag_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/19 17:07:22 by dgaillet #+# #+# */
/* Updated: 2025/11/19 19:53:38 by dgaillet ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <unistd.h>
int nbr_size_base(unsigned long long nb, int base_size)
{
int count;
count = 0;
if (nb == 0)
return (1);
while (nb)
{
count++;
nb /= base_size;
}
return (count);
}
int print_chars(int nb, char c)
{
int count;
count = 0;
while (nb > 0)
{
count += write(1, &c, 1);
nb--;
}
return (count);
}