minishell
ft_strnlen.c
Go to the documentation of this file.
1 /* ************************************************************************** */
2 /* */
3 /* ::: :::::::: */
4 /* ft_strnlen.c :+: :+: :+: */
5 /* +:+ +:+ +:+ */
6 /* By: kfujita <kfujita@student.42tokyo.jp> +#+ +:+ +#+ */
7 /* +#+#+#+#+#+ +#+ */
8 /* Created: 2022/04/23 22:43:26 by kfujita #+# #+# */
9 /* Updated: 2022/04/25 23:29:42 by kfujita ### ########.fr */
10 /* */
11 /* ************************************************************************** */
12 
13 #include <stddef.h>
14 #include "ft_string.h"
15 
16 size_t ft_strnlen(const char *str, size_t max_len)
17 {
18  size_t len;
19 
20  len = 0;
21  while (len < max_len && *str != '\0')
22  {
23  str++;
24  len++;
25  }
26  return (len);
27 }
size_t ft_strnlen(const char *str, size_t max_len)
Definition: ft_strnlen.c:16