Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Feb 1998 06:30:01 -0800 (PST)
From:      Zach Heilig <zach@gaffaneys.com>
To:        freebsd-bugs
Subject:   Re: misc/5856: atof/strtod busted
Message-ID:  <199802261430.GAA24733@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/5856; it has been noted by GNATS.

From: Zach Heilig <zach@gaffaneys.com>
To: aryeh@rad-inet.com, freebsd-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: misc/5856: atof/strtod busted
Date: Thu, 26 Feb 1998 07:36:56 -0600

 On Thu, Feb 26, 1998 at 12:04:58AM -0800, aryeh@rad-inet.com wrote:
 > >Description:
 > atof for any string either containing numbers, alpa, or alphanum always
 > returns a value of 1	
 > >How-To-Repeat:
 > main()
 > {
 > 	duble foo;
 > 
 > 	foo=atof("3.145");
 > 	printf("%f",foo);
 > }
 
 You need to include headers for the functions you call.  In this case, you need
 <stdio.h> for printf() and <stdlib.h> for atof.  Then your program works:
 
 #include <stdio.h>
 #include <stdlib.h>
 
 int
 main(void)
 {
   double foo;
 
   foo = atof("3.1415");
   printf("%f\n", foo);
 
   return 0;
 }

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802261430.GAA24733>