-
Notifications
You must be signed in to change notification settings - Fork 0
User Program Tip
Seonghyeon edited this page Oct 22, 2016
·
3 revisions
/* Copies string SRC to DST. If SRC is longer than SIZE - 1 characters, only SIZE - 1 characters are copied. A null terminator is always written to DST, unless SIZE is 0. Returns the length of SRC, not including the null terminator.
strlcpy() is not in the standard C library, but it is an increasingly popular extension. See http://www.courtesan.com/todd/papers/strlcpy.html for information on strlcpy(). */ size_t strlcpy (char *dst, const char *src, size_t size) { size_t src_len;
ASSERT (dst != NULL); ASSERT (src != NULL);
src_len = strlen (src);
if (size > 0)
{
size_t dst_len = size - 1;
if (src_len < dst_len)
dst_len = src_len;
memcpy (dst, src, dst_len);
dst[dst_len] = '\0';
}
return src_len;
}
stdio.h
안에 들어있음
hex_dump(한 줄에 몇개의 바이트 출력할 지 개수, 시작 주소(물리적 주소), 출력할 바이트 개수, 아스키 코드 변환 여부);