strto[dl]

david.f.prosser dfp at cbnewsl.ATT.COM
Fri Jul 7 00:28:38 AEST 1989


In article <12458 at bloom-beacon.MIT.EDU> scs at adam.pika.mit.edu (Steve Summit) writes:
>Microsoft's implementation of strtol (or was it strtod?  I
>forget) returns, when given the string " x", a 0, with the "end
>pointer" argument pointing to the 'x'.  I think this is a bug.

All of strto{d,l,ul} have the same statement:

	If the subject sequence is empty, or does not have the expected
	form, no conversion is performed; the value of nptr [the char *
	parameter] is stored in the object pointed to by endptr [the
	char ** parameter], provided that endptr is not a null pointer.

Thus, if any of these functions are passed the string " x", the character
pointed to by the end pointer should be the space.

Dave Prosser	...not an official X3J11 answer...



More information about the Comp.std.c mailing list