flat assembler
Message board for the users of flat assembler.
Index
> Windows > dotted IP address string |
Author |
|
anon 31 Dec 2008, 11:54
hi
I got ip string like here Code: ip db '72.14.205.100',0 how to add 1 or 10 or 1000? thanks. |
|||
31 Dec 2008, 11:54 |
|
ManOfSteel 31 Dec 2008, 15:00
1. Use the inet_addr API to convert the IP address to an integer. Use bit rotation instructions to convert back and forth between host/network byte orders (ntohl and htonl APIs do that too), and add/inc to modify any of the four parts.
or 2. Manually parse the IP address string, convert the parts to decimal and modify accordingly. |
|||
31 Dec 2008, 15:00 |
|
Picnic 31 Dec 2008, 21:23
Here's a solution of doing that, hope it helps.
Code: invoke inet_addr, ip ; dot notation string to network bytes invoke ntohl, eax ; from tcp/ip network order to host byte order inc eax ; add 1 invoke htonl, eax ; from host to tcp/ip network bytes invoke inet_ntoa, eax ; network bytes to dot notation string invoke lstrcpy, ip, eax ; save back to buffer, mind the extra space you might need ;ip = '72.14.205.101',0 |
|||
31 Dec 2008, 21:23 |
|
anon 02 Jan 2009, 08:51
hi
I have to read more about APIs functions. Merry Christmas all. |
|||
02 Jan 2009, 08:51 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.