메모리 및 문자열 복사 함수들...
글쓴이: kernelbomb / 작성시간: 금, 2003/12/12 - 11:52오전
안녕하세요? 다름이 아니오라 이해 안가는 부분이 있어서 이렇게
글을 씁니다.
보통 문자열을 복사할 때, strcpy를 쓰지만, 버그가 있어서 strdup나
strncpy를 쓰게 되는데요. strdup는 복사하기 전에 포인터에 메모리를
malloc으로 할당하고 복사한다고 맨페이지에 나오더군요.
그리고 memcpy 함수를 사용하기 위해선 메모리를 영역을 확보하고
사용을 하게 되는데 기타 이런 다른점 말고 strdup나 memcpy가
특정하게 사용하면 좋은 점이 있는 건가요? 뭐 속도라든지, 기타 등등...
너무 궁금하네요. 위의 다른점 말고 다른 차이점이 있는지요?
날씨 추운데 건강하세요~!
Forums:
http://bbs.kldp.org/viewtopic.php?t=2650
http://bbs.kldp.org/viewtopic.php?t=26508&highlight=strcpy+memcp
검색합시다 ^^
울랄라~ 호기심 천국~!!
http://www.ezdoum.com
댓글 달기