Problem with atof

Discussion and support of the compiler from ImageCraft for the M8C.

Moderator: richard@imagecraft.com

Problem with atof

Postby darknumbers » Mon Mar 05, 2012 7:21 pm

Hello,

Currently I'm looking for a way to load numbers in ascii characters and convert them to double or float for further calculations. The atof should be the command that I'm looking for. But it always return 1.0 regardless the loaded ascii numbers.

Are there any examples for this command? I will post my coding tomorrow, since the project file is not with me at the moment.

Thank you very much!
darknumbers
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 14
Joined: Sun Oct 30, 2011 9:16 am

Re: Problem with atof

Postby bobmarlowe » Tue Mar 06, 2012 4:03 am

I just checked it on a CY29466 and atof worked well, but sprintf of a float didn't :mrgreen:

Bob
User avatar
bobmarlowe
The Big Cheese
The Big Cheese
 
Posts: 1490
Joined: Thu Oct 06, 2011 2:03 am
Location: Germany

Re: Problem with atof

Postby darknumbers » Tue Mar 06, 2012 5:53 pm

Thanks again Bob. Anyway, I tried to program the code again this afternoon, and now the command is working! The problem is probably caused by the messy structures of my programming codes. Will try to look for the causes when I finished my assignment. :)

BTW, I haven't tried to use sprintf for any float before. Instead, I'm using ftoa to print float numbers on virtual terminal, though I'm not sure whether this is a right choice or not.... Haha.
darknumbers
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 14
Joined: Sun Oct 30, 2011 9:16 am


Return to “%s” ImageCraft ICCv7 for M8C Compiler

Who is online

Users browsing this forum: No registered users and 1 guest