Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!nuchat!sugar!peter From: peter@sugar.UUCP (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: System V manuals (was Re: What real non-UNIX 'C' compilers...) Message-ID: <830@sugar.UUCP> Date: Sun, 27-Sep-87 21:53:36 EDT Article-I.D.: sugar.830 Posted: Sun Sep 27 21:53:36 1987 Date-Received: Thu, 1-Oct-87 05:13:33 EDT References: <672@sugar.UUCP> <3545@venera.isi.edu> <721@sugar.UUCP> <29156@sun.uucp> Organization: Sugar Land UNIX - Houston, TX Lines: 40 First of all, the generic System 5 release 2 manual are arranged the same way as the SVID. I haven't seen the release 3 manuals. For that matter I haven't seen release 3. I kind of wish I'd never seen release 2. > The difference is not "'fread' is a library routine" (in fact, > they're *both* library routines on most implementations, one just happens > to be relatively trivial - at least on UNIX systems), Yeh, but we're talking about UNIX systems here. What else would we be doing with a UNIX manual? Read is the UNIX primitive for reading data from a file, and as such it's intrinsically different from fread, which involves a fair amount of code (stdio) that you may want to avoid dragging in (say, because you're running out of space on a PDP-11 or IBM-PC). Other differences between read and fread (and write and fwrite) include: [ I'm sure you're alreday familiar with most of these, but... ] read leaves the I/O pointer pointing at the next byte to read. This is important because of the way UNIX deals with inhertance of file descriptors. Consider the version 6 implementation of "if". writes to a pipe are atomic. fwrites probably aren't. a 1-byte read from a character special device in raw mode will be satisfied by 1 byte. A 1-byte fread may not be. a 1-byte read from a pipe will be satisfied by 1 byte. A one byte fread almost certainly won't be. consider the behaviour of fflush. consider what happens if a program traps out with data still in the buffer. the syntax of fread is different from read (and I consider this a design flaw of the same magnitude as giving bitwise-and its weird priority in 'C'. -- -- Peter da Silva `-_-' ...!hoptoad!academ!uhnix1!sugar!peter -- 'U` Have you hugged your wolf today? -- Disclaimer: These aren't mere opinions... these are *values*.