Strtol and strtoul...
Mark H. Colburn
markc at com2serv.c2s.mn.org
Fri Dec 15 16:39:24 AEST 1989
I have a question about the wording of the descriptions for the strtol
and strtoul library calls in the ANSI draft standard (I have the October 31,
1988 version): where should endptr point to if an error occurs?
For example, given the following code:
unsigned long foo;
char *ptr;
foo = strtoul("-12345", &ptr, 0);
where would ptr point to? The call should return ULONG_MAX with errno
set to ERANGE, but does *ptr = '-' or '\0' (end of string) or is it
indeterminate? It looks as if it should point to '\0', but...
Mark H. Colburn mark at minnetech.mn.org
Open Systems Architects, Inc.
More information about the Comp.lang.c
mailing list