Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mailrus!uflorida!novavax!twwells!bill From: bill@twwells.com (T. William Wells) Newsgroups: comp.lang.c Subject: Re: strncpy Message-ID: <1990Jan7.145719.15574@twwells.com> Date: 7 Jan 90 14:57:19 GMT References: <11527@csli.Stanford.EDU> <000003Q@cdis-1.UUCP> <11616@csli.Stanford.EDU> Organization: None, Ft. Lauderdale, FL Lines: 15 In article kuro@Corp.Sun.Com writes: : I have no opinion about philosophical correctness of the current behavior of : strncpy() but always do: : strncpy(to, from, n); : to[n]=0; : This ensures the copied string is always null-terminated, if this is what you : mean by "safe". Maybe you meant "to[n - 1]=0;"? If the size of to is n, to[n] = 0 is illegal. --- Bill { uunet | novavax | ankh | sunvice } !twwells!bill bill@twwells.com