Talk:Strcpy

From Wikipedia, the free encyclopedia

Would someone like to take on the issue of NULL pointers passed in as destination or source strings ??

I find that src can be NULL on some platforms, and other will cause segfaults.

[edit] Corrections

I removed the sizeof(char) multiplication from the malloc lines because sizeof(char) is garanteed to always be 1 in the C language specification (this is not always true with wide characters, but they use wchar_t or some other type) --Michael Lynn 02:29, 2 November 2006 (UTC)

[edit] Bounds checking variants

I changed the name of this section from strncpy to bounds checking variants because this section talks about 3 variants, only one of which was strncpy...it also makes this article look match strcat better because they have a similar section. I also added a note that strncpy will zero out all the data in the output buffer up to the max length because this has some performance drawbacks (many large programs have replaced strncpy for this reason)...I also added in a cautionary note that strncpy does not null terminate strings if there is max len bytes or byte of input as this has stability concerns --Michael Lynn 01:45, 2 November 2006 (UTC)

[edit] strncpy

Search for strncpy shows the strcpy page. This is confusing. Once I worked out that I was not continually mistyping strncpy I looked for strncpy info on the strcpy page. There is very little info and the strcpy page does not show strncpy syntax. 82.33.206.46 12:47, 14 March 2007 (UTC)william