char *strcat(), *strcpy(), *fgets();

Doug Gwyn gwyn at brl-smoke.ARPA
Fri Jun 24 04:07:34 AEST 1988


In article <1309 at ark.cs.vu.nl> maart at cs.vu.nl (Maarten Litmaath) writes:
>Why do the functions named above return 'char *', instead of 'int', viz. the
>REALLY useful new size of the first argument string, or the number of chars
>moved?

"Historical reasons."

>Will this feature ever be changed?

No.  That would break a large number of existing correctly-written programs.

>One gets() tired of typing '(void) strcpy(buf, str);'.

Oh, I don't know about that.  Here is a real example from source code
I happened to have open in another layer on my terminal:

	(void)strcat(strcat(strcat(strcat(strcat(strcpy(fn,
							TargetDir
						       ),
       						 target
						),
					  Slash
  					 ),
 				   approx
   				  ),
  			    Slash
    			   ),
   		     CCMAP
     		    );



More information about the Comp.std.c mailing list