R
rzed
I coded a while loop this way:
while( fgets( buff, MAXBUFF, ifp ) != NULL && rtype == 0 )
....
with the effect that buff contained every other line in the file (that is, the first, third, fifth, etc.).
Coding it this way:
while( rtype == 0 && fgets( buff, MAXBUFF, ifp ) != NULL )
....
put every line in the file in buff. 'rtype' was set to zero before the loop in each case, and within the loop it might or might not be altered, but that logic did not change.
What's going on here? Why would I get different results?
while( fgets( buff, MAXBUFF, ifp ) != NULL && rtype == 0 )
....
with the effect that buff contained every other line in the file (that is, the first, third, fifth, etc.).
Coding it this way:
while( rtype == 0 && fgets( buff, MAXBUFF, ifp ) != NULL )
....
put every line in the file in buff. 'rtype' was set to zero before the loop in each case, and within the loop it might or might not be altered, but that logic did not change.
What's going on here? Why would I get different results?