M
M
Moolzv Rivers2020-02-12 18:02:14
assembler
Moolzv Rivers, 2020-02-12 18:02:14

[MASM32] How to convert string to number?

Hello.
There is such WinApi MASM32 code:

...
.IF ax == BN_CLICKED
    invoke GetWindowText, hwndEdit1, ADDR text1, 128
                 ; Мне нужно текст в text1 преобразовать в число, повысить его на +1 и установить в hwndEdit2

.ENDIF
...

I will somehow suffer myself to set and increase the number, but here's how to convert a string to a number and vice versa ????
Please write an easy solution with comments, I'm still only understanding assembler

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2020-02-12
@jcmvbkbc

I need to convert the text in text1 to a number, raise it by +1 and set it to hwndEdit2

This can be done without converting the string to a number and vice versa: you need to find the end of the string and move to the beginning to check the current character. If it is -- '9' -- { replace it with '0'. If it was the first character in the string, prefix it with a '1' and finish, otherwise continue browsing. } If it's not '9' -- increase its code by 1 and finish.
'9' is for decimal.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question