본문 바로가기

42seoul52

ft_strncmp strncmp? #include int strncmp(const char *s1, const char *s2, size_t n); Linux manpage description : The strcmp() function compares the two strings s1 and s2. The locale is not taken into account (for a locale-aware comparison, see strcoll(3)). It returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2. The strnc.. 2023. 2. 16.
ft_strlcpy strlcpy? #include size_t strlcpy(char *dst, const char *src, size_t size); Linux manpage description : The strlcpy() function copies up to size - 1 characters from the NUL-terminated string src to dst, NUL-terminating the result. The strlcpy() and strlcat() functions return the total length of the string they tried to create. For strlcpy() that means the length of src. 해석 및 부연설명 : memcpy 함수에서 봤던.. 2023. 2. 16.
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.