Reputation: 25
I got the IP address from SQL Server database. Now i have this IP Address in a 'char'. But, I want convert the string IP (example: "127.0.0.1") To the IPADDRESS Control .. I'm this PIC HERE How we do that :D ?
Upvotes: 2
Views: 2528
Reputation: 409136
You can use the InetPton
function to convert it to a binary address, that can then be used to set the control.
char ip_address_string[] = "127.0.0.1";
DWORD address;
if (LOBYTE(LOWORD(GetVersion())) >= 6)
{
IN_ADDR address_struct;
InetPtoN(AF_INET, ip_address_string, &address_struct);
address = (DWORD) address_struct.S_un.S_long;
}
else
{
address = (DWORD) inet_addr(ip_address_string);
}
Now you can use address
to initialize the control.
Upvotes: 3