[TUHS] v7 K&R C

Larry McVoy lm at mcvoy.com
Sat May 16 06:03:54 AEST 2020


I think every old Unix hand does

	int	c;	// EOF is typically -1


On Fri, May 15, 2020 at 04:01:23PM -0400, ron at ronnatalie.com wrote:
> Unfortunately, if c is char on a machine with unsigned chars, or it???s of type unsigned char, the EOF will never be detected.
> 
>  
> 
>  
> 
>  
> 
> *	while ((c = getchar()) != EOF) if (c == '\n') { /* entire record is now there */
> 
>  
> 

-- 
---
Larry McVoy            	     lm at mcvoy.com             http://www.mcvoy.com/lm 


More information about the TUHS mailing list