R
Richard Bos
Keith Thompson said:The above was written by RjY <[email protected]>.
No, it wasn't; it was written by me.
Rafael, please don't delete attribution lines for quoted text.
And please don't top-post. See the following for more information:
http://www.caliburn.nl/topposting.html
http://www.cpax.org.uk/prg/writings/topposting.php
Quite.
Second, you've changed the meaning of the code. This:
fread(...)
is true if fread returns any non-zero value, whereas this:
fread(...) == 1
is true only if fread returns 1. As it happens, fread with the value
1 as its third argument can only return 1, so it doesn't matter in
this case. But consider what would happen if, rather than fread, you
were using fscanf, which can return either the number of items scanned
(possibly 0) or EOF.
More to the point, consider what would happen if you changed the 1 to an
n, because your requirements change and your code must now be able to
read a number of elements at once. You now want to know whether it read
all the elements, not (or rarely, anyway) whether it read any at all
regardless how many.
Richard