본문 바로가기

분류 전체보기174

ft_strlcat strlcat? #include size_t strlcat(char *dst, const char *src, size_t size); Linux manpage description : The strlcat() function appends the NUL-terminated string src to the end of dst. It will append at most size - strlen(dst) - 1 bytes, NUL-terminating the result. The strlcpy() and strlcat() functions return the total length of the string they tried to create. For strlcat() that means the initial.. 2023. 2. 16.
ft_strchr strchr? #include char *strchr(const char *s, int c); Linux manpage description : The strchr() function returns a pointer to the first occurrence of the character c in the string s. 해석 및 부연설명 : 문자열 s에서 문자 c를 탐색하여 가장 처음 발견하는 곳의 위치를 포인터로 반환하는 함수다. 찾지 못한경우 NULL을 반환한다. ex) charstr[] = "abcdefgehijk"; charc = 'e'; printf("%s\n", strchr(str, c)); 코드 실행 결과 efgehijk 정상적으로 문자 c에 저장된 값인 'e'를 찾아낸 후 주소값이 반환되.. 2023. 2. 16.
ft_bzero bzero? #include void bzero(void *s, size_t n); Linux manpage description : The bzero() function erases the data in the n bytes of the memory starting at the location pointed to by s, by writing zeros (bytes containing '\0') to that area. 해석 및 부연설명 : memset과 똑같이 작동하지만 오로지 \0으로만 채울 수 있다. 다만 리턴값 없이 단순히 메모리를 0으로 초기화하는 용도인 듯 하다. deprecated(시대에 뒤쳐졌다는 의미) 되었으니 대신 memset을 사용하라고 한다. ex) int i = -1; char .. 2023. 2. 16.
ft_memmove memmove? #include void *memmove(void *dst, const void *src, size_t n); Linux manpage description : The memmove() function copies n bytes from memory area src to memory area dst. The memory areas may overlap: copying takes place as though the bytes in src are first copied into a temporary array that does not overlap src or dst, and the bytes are then copied from the temporary array to dst. 해석 및 부.. 2023. 2. 16.