Re: rotation problem again

From: CBFalconer (cbfalconer_at_yahoo.com)
Date: 03/19/04


Date: Fri, 19 Mar 2004 04:42:14 GMT

Roger Willcocks wrote:
> "Roger Willcocks" <rkww@rops.org> wrote in message
> ...
> > char str[10];
> ...
> > strcpy(str, "abcdefghij");
>
> Damned C-strings...
>
> char str[10+1];
>
> of course.

    if (sizeof str <= strlcpy(str, "abcdefghij", sizeof str))
       puts("Not enough room, str is truncated");

see <http://cbfalconer.home.att.net/download/strlcpy.zip>
see <http://www.courtesan.com/todd/papers/strlcpy.html>

strlcpy is non-standard, and should be renamed unless proven
conflict free in your system because the name belongs to the
implementation space. str_lcpy will do.

-- 
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!