Newsgroups: comp.std.c
Path: utzoo!telly!druid!darcy
From: darcy@druid.uucp (D'Arcy J.M. Cain)
Subject: Re: strtol
Organization: D'Arcy Cain Consulting, West Hill, Ontario
Distribution: comp
Date: Tue, 20 Nov 90 14:36:43 GMT
Message-ID: <1990Nov20.143643.4178@druid.uucp>
References: <MATTES.90Nov19122748@azu.informatik.uni-stuttgart.de>

In article <MATTES.90Nov19122748@azu.informatik.uni-stuttgart.de> mattes@azu.informatik.uni-stuttgart.de (Eberhard Mattes) writes:
>Is the behavior of strtol defined in the ANSI standard?
Yes.

>What should
>    strtol ("089", NULL, 0)
>return?

It should return 0.  Since it is an octal number (based on the leading 0)
the scan stops at the first character not a digit in base 8 which is the
'8' thus the scanned string is "0" and hence 0 is returned.

-- 
D'Arcy J.M. Cain (darcy@druid)     |
D'Arcy Cain Consulting             |   I support gun control.
West Hill, Ontario, Canada         |   Let's start with the government!
+ 416 281 6094                     |
