Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: What about errno==0 ? Keywords: errno, errorcheck, standard Message-ID: <13358@smoke.BRL.MIL> Date: 16 Jul 90 14:26:40 GMT References: <7798@mcshh.hanse.de> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 12 In article <7798@mcshh.hanse.de> bkr@mcshh.hanse.de (Bjoern Kriews) writes: -I am want to let my code now whether a routine returning NULL on failure -failed because of an I/O Error are for a logical mistake. For example, -I'm setting a global variable = errno after a failed malloc(), then do -an fclose() and return. I want to set this global to zero if the code -failed because of any error not setting errno. -What does the standard say about the value 0 for errno ? -Can I assume that there is no errno.h defining any errorcode = 0 ? As I understand your question, the answer is that all error numbers that may be set by standard library functions are positive integers. Therefore you may safely assume that a code of 0 is different from any error code.