-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcut_right.c
More file actions
29 lines (26 loc) · 1.12 KB
/
cut_right.c
File metadata and controls
29 lines (26 loc) · 1.12 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* cut_right.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hiroshiusui <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/01/31 02:37:38 by hiroshius #+# #+# */
/* Updated: 2018/01/31 02:37:39 by hiroshius ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
char *cut_right(char *str, int n)
{
int i;
int length;
char *new;
length = ft_strlen(str);
if (n >= length)
return ("");
new = ft_strnew(length - n);
i = 0;
while (i < (length - n))
new[i++] = *str++;
return (new);
}