12345678910111213141516171819202122232425262728 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_strncpy.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: mazimi <mazimi@student.42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2014/11/04 16:28:55 by mazimi #+# #+# */
- /* Updated: 2014/12/02 16:05:34 by mazimi ### ########.fr */
- /* */
- /* ************************************************************************** */
- #include "libft.h"
- char *ft_strncpy(char *dest, char *src, unsigned int n)
- {
- unsigned int i;
- i = -1;
- if (dest == NULL)
- return (NULL);
- while (src[++i] != '\0' && i < n)
- dest[i] = src[i];
- if (i < n)
- while (i < n)
- dest[i++] = '\0';
- return (dest);
- }
|