Subject: Re: strncpy vs. strncat
To: Andrew Brown <twofsonet@graffiti.com>
From: Assar Westerlund <assar@sics.se>
List: tech-userlevel
Date: 02/13/1999 11:54:03
Andrew Brown <twofsonet@graffiti.com> writes:
> wouldn't strncat be much better off if it thought the same way as
> strncpy?

The other way around, but they are defined by ANSI/ISO so there's not
much to do about it.  The other difference is that strncpy fills the
destination with zeros.  Usually that's not what you want.  I tend to
use snprintf/asprintf and str{cpy,cat}_truncate that have the
semantics I would have liked strn{cpy,cat} to have.  You can find the
later two functions in
ftp://ftp.pdc.kth.se/pub/krb/src/krb4-0.9.9.tar.gz.

/assar