--- /dev/null
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_atol.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2024/04/26 16:18:28 by dkaiser #+# #+# */
+/* Updated: 2024/04/26 17:56:54 by dkaiser ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "push_swap.h"
+
+long ft_atol(const char *str)
+{
+ long result;
+ int i;
+ int posneg;
+
+ posneg = 1;
+ result = 0;
+ i = 0;
+ while ((str[i] >= '\t' && str[i] <= '\r') || str[i] == ' ')
+ {
+ i++;
+ }
+ if (str[i] == '-')
+ {
+ posneg = -1;
+ i++;
+ }
+ else if (str[i] == '+')
+ i++;
+ while (str[i] >= '0' && str[i] <= '9')
+ {
+ result = 10 * result + str[i] - '0';
+ i++;
+ }
+ return (result * posneg);
+}