Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ogicse!decwrl!shelby!csli!poser From: poser@csli.Stanford.EDU (Bill Poser) Newsgroups: comp.lang.c Subject: Re: strncpy Message-ID: <11616@csli.Stanford.EDU> Date: 5 Jan 90 21:47:58 GMT References: <11527@csli.Stanford.EDU> <000003Q@cdis-1.UUCP> Sender: poser@csli.Stanford.EDU (Bill Poser) Reply-To: poser@csli.stanford.edu (Bill Poser) Organization: Center for the Study of Language and Information, Stanford U. Lines: 13 In article <000003Q@cdis-1.UUCP> tanner@cdis-1.UUCP (Dr. T. Andrews) writes: >Your consideration of strcpy()/strncpy() is more than a little >reminiscent of a man who has in hand a claw hammer and a ball peen >hammer, and who wishes to know why he can't pull nails with the >latter. Not really. It's more like the question of why the carpentry shop has a ball peen hammer (used for metal working) and doesn't have a claw hammer. strncpy is a function evidently designed for use with fixed-length character buffers, not the null-terminated strings that are semi-standard in C. That makes one wonder why strncpy is included with functions that are intended for use with null-terminated strings, and why there is no "safe" copying function for the latter.