Path: utzoo!attcan!uunet!samsung!think!mintaka!bloom-beacon!eru!luth!sunic!mcsun!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.lang.c Subject: Re: strncpy Message-ID: <4904@pinas.cs.vu.nl> Date: 21 Dec 89 19:24:24 GMT References: <11509@csli.Stanford.EDU> Reply-To: maart@cs.vu.nl (Maarten Litmaath) Organization: VU Informatika, Amsterdam, the Netherlands Lines: 15 In article <11509@csli.Stanford.EDU> poser@csli.Stanford.EDU (Bill Poser) writes: \ \ Why is it that strncpy(3) does not null terminate \the string if the length of the source string is greater than \or equal to the length of the target buffer? I cannot think of \any circumstances in which this behaviour is desirable, and \always end up null terminating it myself. [...] So you have to write nstrncpy(), a function that always null-terminates the destination, just like you have to write your own str*c{at,py} functions if you want them to return something USEFUL, instead of their first arguments, e.g. the new length of the destination. :-( -- 1755 EST, Dec 14, 1992: Henry Spencer is put on a one-way mission to the moon.| Maarten Litmaath @ VU Amsterdam: maart@cs.vu.nl, uunet!mcsun!botter!maart