Path: utzoo!attcan!utgpu!watmath!clyde!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: #include Message-ID: <11252@haddock.ima.isc.com> Date: 21 Dec 88 04:27:19 GMT References: <354@greens.UUCP> <1920@paris.ics.uci.edu> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 14 In article <1920@paris.ics.uci.edu> nagel@blanche.ics.uci.edu (Mark Nagel) writes: >... it would be nice to have something like this be part of the standard C >library so that one could check validity of things like atoi, etc. "Something like it" *is* in the Standard C library. Check strtod() (for floating point) and strtol() (for integer); each scans and evaluates its string, and returns enough information to distinguish failure from valid return values. Btw, the posted version of the function accepts "3.14xyz" as valid (as does atof() itself). I would think that the problem as stated should require that string to be rejected. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint