strtod vs NAN?

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Thu May 13 19:21:25 PDT 2004


On Thu, 2004-05-13 at 22:14, Larry Rosenman wrote:
>   char **ptr;
> 
>   num=strtod(input,ptr);

Since ptr is uninitialized, strtod() is trying to store a pointer into
random memory.  You probably want to say this instead:

    char *ptr;

    num = strtod(input, &ptr);

-- 
brandon s. allbery    [linux,solaris,freebsd,perl]     allbery at kf8nh.com
system administrator      [WAY too many hats]        allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon univ.         KF8NH



More information about the freebsd-current mailing list