-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathft_strnlen.c
22 lines (19 loc) · 1.04 KB
/
ft_strnlen.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vbrazhni <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/07/04 15:47:51 by vbrazhni #+# #+# */
/* Updated: 2018/07/04 15:47:52 by vbrazhni ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strnlen(const char *s, size_t maxlen)
{
char *ptr;
if ((ptr = ft_memchr(s, '\0', maxlen)))
return (size_t)(ptr - s);
return (maxlen);
}