I'd guess you're seeing some of the design decisions in stdio, that were rather "controversial", back around Version 7 Unix, inside Bell Labs, circa late 1978, when stdio was first introduced.
I've avoided using fread(3S) "forever", even to the point of rolling my own i/o buffering library, the most recent incarnation of which can be found at https://github.com/ThePythonicCow/rawscan The fixed input buffer size of my 'rawscan' probably makes it unsuitable for most uses such as GNU grep that expect to handle arbitrarily long input lines. This 'rawscan' scans over and otherwise ignores the tail end of any input line that exceeds the line length you specified when opening the buffer stream. On a very large test case rather carefully chosen to highlight the performance of rawscan, it was over twice as fast searching for a fixed pattern than was grep. See the "Comparative Performance" section of rawscan's github page for these results: https://github.com/ThePythonicCow/rawscan -- Paul Jackson p...@usa.net