-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_wcstrsub.c
32 lines (29 loc) · 1.19 KB
/
ft_wcstrsub.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_wcstrsub.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaraval <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/01/17 08:24:32 by tmaraval #+# #+# */
/* Updated: 2018/01/17 08:31:43 by tmaraval ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
wchar_t *ft_wcstrsub(wchar_t const *s, unsigned int start, size_t len)
{
wchar_t *s1;
size_t i;
i = 0;
if (s == NULL)
return (NULL);
if ((s1 = malloc(sizeof(wchar_t) * (len + 1))) == NULL)
return (NULL);
while (s[i] && i < len)
{
s1[i] = s[start + i];
i++;
}
s1[i] = '\0';
return (s1);
}