I understand the differences between fgets()
and fgetss()
but I don't get the difference between fgets()
and fread()
, can someone please clarify this subject? Which one is faster? Thanks!
+9
A:
fgets
reads a line -- i.e. it will stop at a newline.
fread
reads raw data -- it will stop after a specified (or default) number of bytes, independantly of any newline that might or might not be present.
Speed is not a reason to use one over the other, as those two functions just don't do the same thing :
Pascal MARTIN
2010-05-01 21:38:36