I think at least one reason is because <> is line-oriented, in the sense that it scans the data for the next line separater and returns everything before that (well, since the last line separater). On the other hand,
read is block-oriented. You tell it how big of a block you want, and it reads in that many bytes. It doesn't look at or scan through the data like <> does. So it depends on how much structure you want. If you want the next line of text, <> does that for you, at the cost of a little speed. If you just want the next n-byte chunk,
read is faster. You could try to implement <> with
read, but what you'd end up doing is reading in some kind of "reasonable" size chunk and scanning through it for the line separater, throwing the rest away or maybe needing to get the next check to find the end of line. And that method doesn't really have any advantages over just using <> in the first place.
kelan
Yak it up with Fullscreen ChatterBox