Path: utzoo!utgpu!attcan!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: lint question Message-ID: <858@auspex.UUCP> Date: 18 Jan 89 05:40:37 GMT References: <491@babbage.acc.virginia.edu> <9322@smoke.BRL.MIL> <15024@cisunx.UUCP> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 27 >Okay, so where does one find out what error codes are returned from these >stdio functions? The UNIX (AT&T 3B2) manuals I have say nothing in printf(3S) >about error codes, If by "error codes" you mean something like "errno" codes, "printf"-family routines don't return them, but then *no* UNIX routine I know of returns one - they all "return" them by setting "errno". The section 2 manual pages explicitly list values to which "errno" will be set (although the lists are quite often incomplete); unfortunately, most section 3 manual pages don't. By and large, you can probably expect that they can return any of the ones "read" or "write" can return ("write" in the case of "printf", for example), and that they *may* return any of the others. If you mean "how can I test to see if they got an error *at all*," the AT&T 3B2 S5R3 manual says: Each function returns the number of characters transmitted (not counting the \0 in the case of "sprintf"), or a negative value if an output error is encountered. in the first paragraph; perhaps earlier documentation didn't say this. The dpANS (or is it a pANS now?) says basically the same thing. Some older versions of UNIX, and some other versions of UNIX, or environments within those vesrions, that maintain compatibility with those older versions, have different return values (0 on success, -1 on error), but over time those versions will most likely adopt the dpANS conventions.