On , Thomas Maeder (2:301/138@fidonet) wrote:
> Note that strncpy in general does *not* zero-terminate its target.
Excerpted from SNIP_STR.H in SNIPPETS...
/*
** Safe string macros by Keiichi Nakasato
*/
/* strncpy() variants that are guaranteed to append NUL */
#define strn1cpy(d,s,n) (strncpy(d,s,n),(d)[n]=0,d)
#define strn0cpy(d,s,n) strn1cpy(d,s,(n)-1)
/* like strcpy, except guaranteed to work with overlapping strings */
#define strMove(d,s) memmove(d,s,strlen(s)+1)
--- QM v1.00
---------------
* Origin: MicroFirm : Down to the C in chips (1:106/2000.6)
|