DevPinoy.org
A Filipino Developers Community
            

masm32 StrToFloat

Latest post 03-30-2008 2:11 AM by modchip. 1 replies.
  • 03-29-2008 11:11 AM

    • JoeG
    • Top 500 Contributor
    • Joined on 03-29-2008
    • Posts 1
    • Points 120

    masm32 StrToFloat

    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
     

    Filed under: ,
    • Post Points: 20
  • 03-30-2008 2:11 AM In reply to

    • modchip
    • Top 10 Contributor
    • Joined on 02-09-2006
    • Ivalice
    • Posts 589
    • Points 8,345

    Re: masm32 StrToFloat

    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

     

    • Post Points: 5
Page 1 of 1 (2 items) | RSS

Copyright DevPinoy 2005-2008
Powered by Community Server (Commercial Edition), by Telligent Systems