Date: Tue, 7 May 1996 20:28:15 -0400
From: dj (DJ Delorie)
Message-Id: <199605080028.UAA12208@delorie.com>
To: justin AT yoss DOT canweb DOT net
CC: djgpp AT delorie DOT com
In-reply-to: <Pine.BSF.3.91.960507154545.1476A-100000@yoss.canweb.net> (message from Justin Ward on Tue, 7 May 1996 16:14:50 -0400 (EDT))
Subject: Re: totally crazed output


>     if (s[index]==NEWLINE) {
>         s[index]==NULL;
>         return s; // the calling function can print the \n
>     }

Use '=' to assign the terminator, not '==', which compares.

> 
> } // end for loop.
> return s; // this will only happen if the max num of chars are put in.
> }

Programs should be careful about this case, because it will result in
a non-null-terminated string.