|
From: Daniel K. O. <dan...@ya...> - 2004-11-13 00:00:38
|
Den...@ao... wrote: > strncpy(FirstMix,FirstName,3); (...) > has anybody an idea as to where the extra characters are coming from???? They are garbage of uninitialized memory. If you read the documentation for strncpy() you'll see that it copies 3 characters when you call it. None of your 3 characters are the '\0' terminator, because the '\0' it's beyond the 3 chars you are copying (it's the 5th char in "JACK", and 9th in "ROBINSON"). So you get a non-terminated string. When using strncpy() you have always to terminate it by hand. Daniel K. O. |