strtod return ptr not advanced if converted value =0

This code has worked for years in C51:

-----
CmdParm[CmdCnt / 2] = strtod(ParamBuf, &rPos);  // get a number
// returns with rPos pointing to the next unconverted char in the ParamBuf
if(rPos > ParamBuf)  // if something was converted
   CmdCnt += 1;
-----

I just copied it into a C166 program, and it fails to advance the "rPos" return pointer if the value it finds and converts is exactly zero. This happens even in the middle of a long string with non-zero values following the zero value. Increase the value to 0.0001 or 1 and the pointer is advanced.

It is reading ASCII zero characters, so it should be able to tell them apart from the '\0' terminator. C51 does it quite reliably.

Loren

More questions in this forum