PostHeaderIcon MFC Convert DWORD IP Address to CString(Dotted IP Notation)

CString ConvertIP(DWORD ip)
{
	unsigned char a, b, c, d;
	d = ip & 0xFF;
	c = ( ip >> 8 ) & 0xFF;
	b = ( ip >> 16 ) & 0xFF;
	a = ( ip >> 24 ) & 0xFF;  

	CString url;
	url.Format(_T("%u.%u.%u.%u"), a, b, c, d);
	return url;
}
111,368 views

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Copyright © 2010 - C++ Technology. All Rights Reserved.

Powered by Jerry | Free Space Provided by connove.com