Walter Roberson said:
In article <BL******************************@bt.com>,
Richard Heathfield <in*****@invalid.invalidwrote:
>>Walter Roberson said:
>>an equivilent to atoi() that is for long instead of it:
>>Poor advice, since it will lead him to atol() rather than strtol().
The problem was *defined* in terms of restricted sets of input
for which atol() and strtol() will be equivilent.
You do have a point but, as the the OP pointed out, the input data may
contain NULL (by which I guess he means the empty string) or "just blank
spaces". The strtol function will enable these cases to be detected,
whereas atol will IIRC simply return 0.
Now, it's certainly true that he said he just wanted these to be interpreted
as 0, which I missed, and which is why you have a point. But when he
discovers how simple it is to detect them, he may prefer to take advantage
of the extra functionality that strtol() offers.
Shall we call this one 70-30 in your favour? :-)
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)