DevPinoy.org
A Filipino Developers Community

>>> First two to make 3 wins! <<<

masm32 StrToFloat

rated by 0 users
This post has 1 Reply | 1 Follower

Top 500 Contributor
Posts 1
Points 120
JoeG Posted: 03-29-2008 11:11 AM

I'm writing a program that takes in Floating Points and averages them for a CMSC class this weekend. My only problem seems to be the conversion of said floating poing values. When I run this little bit of code, all I ever get out is 41, no matter what I enter. Any help would be much appreicated. Thanks

 

LOCAL inString:DWORD
LOCAL newFP:QWORD
LOCAL answer1[20]:BYTE

mov [inString], input("Please Enter Value")
invoke StrToFloat, ADDR inString, ADDR newFP
invoke FloatToString, newFP, ADDR answer1
invoke StdOut, ADDR answer1
 

Top 10 Contributor
Posts 751
Points 10,140

Hi there Joe! 

I'm not sure if you had a typo or not, but instead of using invoke FloatToString, why not try to use invoke FloatToStr or invoke FloatToStr2.

Example: invoke FloatToStr2, answer[source], ADDR buffer[destination]

LOCAL inString:DWORD
LOCAL newFP:QWORD
LOCAL answer1[20]:BYTE

mov [inString], input("Please Enter Value: ")
invoke StrToFloat, ADDR inString, ADDR newFP
invoke FloatToStr2, newFP, ADDR answer1
print addr answer1

I have attached a compile sample with the exact code as above. Thanks. Hope it works and you make it on time. :D

 

Page 1 of 1 (2 items) | RSS

Copyright DevPinoy 2005-2008