47 lines
1.5 KiB
C
47 lines
1.5 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strcpy.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/03/19 05:59:56 by tischmid #+# #+# */
|
|
/* Updated: 2023/04/01 20:37:11 by tischmid ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
char *ft_strcpy(char *dest, char *src)
|
|
{
|
|
char *o_dest;
|
|
|
|
o_dest = dest;
|
|
while (*src)
|
|
*dest++ = *src++;
|
|
*dest = 0;
|
|
return (o_dest);
|
|
}
|
|
|
|
/* ////
|
|
#include <stdio.h>
|
|
#define BUFSIZE 10
|
|
#define STR "||||||||||"
|
|
|
|
int main(void)
|
|
{
|
|
int arrlen = 4;
|
|
char *teststrings[] = {"", "h", "he", "hey"};
|
|
char buf[BUFSIZE] = STR;
|
|
char *return_val;
|
|
|
|
for (int j = 0; j < arrlen; ++j)
|
|
{
|
|
printf("####### dest = '|' * 10, src == '%s' #######\n", teststrings[j]);
|
|
return_val = ft_strcpy(buf, teststrings[j]);
|
|
printf("RetVal: %s\n", return_val);
|
|
for (int i = 0; i < BUFSIZE; ++i)
|
|
printf((buf[i] >= 32 && buf[i] <= 126) ? "%c\n" : "0x%x\n", buf[i]);
|
|
}
|
|
return (0);
|
|
}
|
|
*/ ////
|