fractol/libft/src/ft_atou.c

32 lines
1.2 KiB
C
Raw Normal View History

2023-03-01 04:36:42 +01:00
/* ************************************************************************** */
/* */
/* :::::::: */
2023-03-07 05:31:00 +01:00
/* ft_atou.c |o_o || | */
2023-03-01 04:36:42 +01:00
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 19:08:11 by djonker #+# #+# */
2023-03-07 05:31:00 +01:00
/* Updated: 2023/03/05 21:13:18 by houtworm \___)=(___/ */
2023-03-01 04:36:42 +01:00
/* */
/* ************************************************************************** */
#include "../libft.h"
unsigned long long ft_atou(char *str)
{
unsigned long long r;
int c;
r = 0;
c = 0;
while ((str[c] == 32) || (str[c] > 8 && str[c] < 14))
c++;
while (str[c] >= '0' && str[c] <= '9')
{
r = 10 * r + (str[c] - '0');
c++;
}
2023-03-07 05:31:00 +01:00
free (str);
2023-03-01 04:36:42 +01:00
return (r);
}