create empty digits_to_words src, implement ft_strlen

This commit is contained in:
Aleksei Chubukov 2023-12-02 23:46:24 +04:00
parent 87005dc165
commit bdf52892a0
5 changed files with 42 additions and 5 deletions

12
ex00/digits_to_words.c Normal file
View File

@ -0,0 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* digits_to_words.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/02 23:40:54 by achubuko #+# #+# */
/* Updated: 2023/12/02 23:43:18 by achubuko ### ########.fr */
/* */
/* ************************************************************************** */
#include "digits_to_words.h"

14
ex00/digits_to_words.h Normal file
View File

@ -0,0 +1,14 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* digits_to_words.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/02 23:35:43 by achubuko #+# #+# */
/* Updated: 2023/12/02 23:36:29 by achubuko ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef DIGITS_TO_WORDS_H
# define DIGITS_TO_WORDS_H
#endif

View File

@ -6,7 +6,7 @@
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/02 21:56:30 by achubuko #+# #+# */
/* Updated: 2023/12/02 22:41:05 by achubuko ### ########.fr */
/* Updated: 2023/12/02 23:45:23 by achubuko ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_utils.h"
@ -15,3 +15,13 @@ uint32_t ft_atoui32(char *str)
{
return (*str - '0');
}
size_t ft_strlen(char *s)
{
size_t l;
l = 0;
while (*s++)
l++;
return (l);
}

View File

@ -6,7 +6,7 @@
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/02 21:01:21 by achubuko #+# #+# */
/* Updated: 2023/12/02 21:55:21 by achubuko ### ########.fr */
/* Updated: 2023/12/02 23:45:57 by achubuko ### ########.fr */
/* */
/* ************************************************************************** */
#include "main.h"
@ -18,5 +18,5 @@ int main(int argc, char **argv)
write(1, "Error: program requires 1 or 2 arguments passed!", 48);
return (1);
}
write(1, argv[1], 1);
write(1, argv[1], ft_strlen(argv[1]));
}

View File

@ -6,12 +6,13 @@
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/02 21:14:25 by achubuko #+# #+# */
/* Updated: 2023/12/02 21:25:18 by achubuko ### ########.fr */
/* Updated: 2023/12/02 23:43:11 by achubuko ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef MAIN_H
# define MAIN_H
# include <unistd.h>
# include <stdlib.h>
# include "digits_to_words.h"
# include "ft_utils.h"
#endif