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: return values and errno Message-ID: <1244@sugar.UUCP> Date: Mon, 7-Dec-87 09:08:38 EST Article-I.D.: sugar.1244 Posted: Mon Dec 7 09:08:38 1987 Date-Received: Sun, 13-Dec-87 01:43:52 EST References: <10224@brl-adm.ARPA> <9272@mimsy.UUCP> <1804@geac.UUCP> <1853@haddock.ISC.COM> Organization: Sugar Land UNIX - Houston, TX Lines: 29 To throw a spanner into the works: On the Amiga, when a system call fails you call IoErr() to find out what went wrong. However, IoErr() takes no arguments. For a general error handling system, you would want to find out the last IoErr on a given stream. If you don't have a stream (say for malloc, or for fopen) you have to fall back to the existing setup. So: #includeif(!(fp = fopen("illegal file name", "r"))) { switch(ioerr(0)) { ... } } if(!fread(...)) { switch(ioerr(fp)) { ... } } But stdio has enough problems (like... why don't read() and fread() have the same arguments?), so let's not & say we did. -- -- Peter da Silva `-_-' ...!hoptoad!academ!uhnix1!sugar!peter -- Disclaimer: These U aren't mere opinions... these are *values*.