Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to contert the ipaddressctrl to cstring

Status
Not open for further replies.

kaya17

Programmer
Feb 9, 2004
78
SG
UpdateData(true);
DWORD dwIPAddress;
CString ip;
int i =0;
m_ipaddress.GetAddress (dwIPAddress);
ip.Format("%d.%d.%d.%d",
HIBYTE (HIWORD (dwIPAddress)),
LOBYTE (HIWORD (dwIPAddress)),
HIBYTE (LOWORD (dwIPAddress)),
LOBYTE (LOWORD (dwIPAddress)),
HIBYTE (HIWORD (dwIPAddress)),
LOBYTE (HIWORD (dwIPAddress)),
HIBYTE (LOWORD (dwIPAddress)),
LOBYTE (LOWORD (dwIPAddress)));

but if the octet value is less than 100, it only displays the non-zero digit. for example, 010.033.001.069 will be displayed as 10.33.1.69.

anybody knows how to make it in the standard three digit per octet format?


thanks.
regards,
kaya









 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top