comp.lang.c

Andrew Koenig ark at alice.UUCP
Mon Aug 28 21:47:48 AEST 1989


In article <744 at oucsace.cs.OHIOU.EDU>, bchurch at oucsace.cs.OHIOU.EDU (Bob Church) writes:

> The following line
> while (rtns = (fread(buf,5,10,ioptr)) == 10)
> rtns being an integer works as long as their are
> 50 byte chunks of data left to be read.

Your problem is that == binds more tightly than =, so that is
equivalent to

	while (rtns = ((fread(buf,5,10,ioptr)) == 10))

Instead you should say

	while ((rtns = fread(buf,5,10,ioptr)) == 10)
-- 
				--Andrew Koenig
				  ark at europa.att.com



More information about the Comp.lang.c mailing list