Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!apple!motcsd!hpda!hpcupt1!hpisod2!decot From: decot@hpisod2.HP.COM (Dave Decot) Newsgroups: comp.sys.hp Subject: Re: Extraneous error code under 3.1? Message-ID: <16710035@hpisod2.HP.COM> Date: 22 Nov 89 09:21:35 GMT References: Organization: Hewlett Packard, Cupertino Lines: 18 > >When we run the following code in either form (with the fgets or fscanf), > >the first fgets/fscanf call returns an error code of 25 . If that is > >cleared, following calls do not touch errno . Would someone else please > >try this and report back your results? > > None of this is surprising; none of the library functions in your program are > supposed to set errno to any reasonable value. The system calls which are > used internally often do use and modify it, however. In general, if the man > page for a function doesn't say it puts an error code into "errno", assume it > trashes it; and furthermore, even for those functions which do return codes > in "errno", the value is only valid only if the actual function return > indictaes that an error occurred (generally, when a system call returns -1). All of the above is completely correct, for HP-UX 3.1. However, please note that all of the functions called in the program in question *do* set errno to a reasonable value in error situations in HP-UX 7.0 or later. Dave