Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!floyd!harpo!seismo!hao!hplabs!sri-unix!phil@rice From: phil%rice@sri-unix.UUCP Newsgroups: net.unix Subject: Re: strncpy Message-ID: <16889@sri-arpa.UUCP> Date: Thu, 23-Feb-84 20:28:49 EST Article-I.D.: sri-arpa.16889 Posted: Thu Feb 23 20:28:49 1984 Date-Received: Fri, 2-Mar-84 11:23:03 EST Lines: 18 From: William LeFebvre"strncpy" copies EXACTLY n characters, regardless of the length of either string. Some programs rely on this particular (some would say peculiar) heuristic of "strncpy". To change it would invite disaster. If you need a function that does a "strncpy" but insures that "s1" is null terminated, I suggest that you write your own and call it something besides "strncpy". All the functions in the str* family are easy to duplicate. Personally, I have frequently added a function called "strecpy" which performs the same function as "strcpy" except that it returns a pointer to the null byte in "s1" rather than the beginning. I found this handy when I wanted to do a bunch of strcats in a row. William LeFebvre Department of Mathematical Sciences Rice University