delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/04/11:22:58

From: "Berti Drost" <Berti DOT drost AT gmx DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: how to use atof?
Date: Sat, 4 Sep 1999 16:23:26 +0200
Organization: NEFkom Telekommunikation GmbH
Lines: 22
Message-ID: <7qr9uh$3fk$1@thetenth.astat.de>
NNTP-Posting-Host: dialin-159.astat.de
X-Server-Date: 4 Sep 1999 14:22:09 GMT
X-Newsreader: Microsoft Outlook Express 4.71.1712.3
X-MIMEOLE: Produced By Microsoft MimeOLE V4.71.1712.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello,
I have some troubles useing the command atof (convert string to double);
the following code isn't produceing the correct results. Can anybody tell me
what the mistake might be? (It occures also, if I use strtod; on the other
hand, atoi (convert str to integer) is working perfectly:-( )

int     main(int argc, char *argv)
{
  char   *zahl="153.34";
  char   *err;
  double out_f;
  out_f=atof(zahl);
//  out_f=strtod(zahl,&err);
  printf("strtod() : %f\n",out_f);
  printf("err=%c\n",*err);
  return(0);
}

Thanx,
BertI


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019