将接收到的IP地址转化为字符串显示(代码)

 BYTE nField0,nField1,nField2,nField3;
 m_ipaddd.GetAddress(nField0,nField1,nField2,nField3);
 //m_ipadd.SetAddress(nField0,nField1,nField2,nField3);
   
 CString   strData1, strData2, strData3, strData4;   
 
 strData1.Format(_T("%.3d"),  nField0 );
 strData2.Format(_T("%.3d"),  nField1 );
 strData3.Format(_T("%.3d"),  nField2 );
 strData4.Format(_T("%.3d"),  nField3);

 CString ipaddress=strData1+'.'+strData2+'.'+strData3+'.'+strData4;
 MessageBox(ipaddress);

时间: 2024-08-03 07:22:49

将接收到的IP地址转化为字符串显示(代码)的相关文章

extjs4.2 grid里怎么格式化IP地址,目前只显示3个数字

问题描述 extjs4.2 grid里怎么格式化IP地址,目前只显示3个数字 extjs4.2 grid里怎么格式化IP地址,目前只显示3个数字 解决方案 renderer:function(v){var arr=v.split('.');return arr[0]+'.'+arr[1]+'.'+arr[2]}

java中IP地址转换十进制数实现代码

先看实例  代码如下 class ip { private static long iptolong(string strip) //将127.0.0.1 形式的ip地址转换成10进制整数,这里没有进行任何错误处理 { int j=0; int i=0; long [] ip=new long[4]; int position1=strip.indexof("."); int position2=strip.indexof(".",position1+1); int

CMD和vbs修改 IP地址及DNS的实现代码_vbs

修改IP cmd /c netsh interface ip set address name=" 本地连接" source=static addr=211.82.56.253 mask=255.255.255.0 gateway=211.82.56.1 gwmetric=1 修改DNS cmd /c netsh interface ip set dns name="本地连接" source=static addr=202.99.192.66 配置或更新IP地址:

PHP获取IP地址输出为数组程序代码

PHP获取服务器IP地址 用PHP执行ifconfig获得Linux服务器IP并输出为数组,下面是代码:  代码如下 复制代码 <?php function getServerIp(){ //用ifconfig读取服务器IP并输出为数组   $ss = exec('/sbin/ifconfig | sed -n 's/^ *.*addr:\([0-9.]\{7,\}\) .*$/\1/p'',$arr);   return $arr;   } $ips=getServerIp();   fore

php隐藏IP地址后两位显示为星号例子

php正则格式化IP地址,隐藏后一位. 例子  代码如下 复制代码 <?php //隐藏后一位 return preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/is',"$1.$2.$3.*",$ip);   //隐藏IP最后几位为* echo ereg_replace("[^\.]{1,3}$","*",$ip); ?> 例子 php实现隐藏Ip地址最后一段或者最后两段的方法    代码如下 复制代

DWORD类型的IP地址转换为CString字符串

从ip地址控件获得的ip地址是DWORD类型的 用MessageBox怎样将ip地址显示出来呢? DWORD类型32位,每4位为一组代表常见的IP地址,即***.***.***.***. 采用HIWORD.LOWORD.HIBYTE.LOBYTE即可解析出各个字段.参考方案如下: DWORD dwIPAddr; CString str; WORD hiWord=HIWORD(dwIPAddr); WORD loWord=LOWORD(dwIPAddr); BYTE nf1=HIBYTE(hiWo

纯真IP数据库的应用 IP地址转化成十进制_php实例

原来是需要把IP转成十进制 复制代码 代码如下: $ip = $_SERVER['REMOTE_ADDR']; echo '你的IP:'.$ip.'<br />'; $ip_arr = explode(".",$ip); $ip = 0; foreach($ip_arr as $i=>$s){ $ip += $s*pow(256,3-$i); } echo '转十进制值:'.$ip.'<br />'; //结果你的IP:127.0.0.1 转十进制值:21

根据用户ip地址提示选择城市php代码(1/7)

css教程代码 @charset "utf-8"; /* css document */ #getplatform { position: absolute; visibility: hidden; width: 180px !important; border: 1px solid #77c608; background: #fcfcfc; cursor: pointer; color: #ff7a23; list-style-type: none; z-index: 9999; }

PHP为表单获取的URL 地址预设 http 字符串函数代码_php技巧

复制代码 代码如下: if (!preg_match("/^(http|ftp):/", $_POST['url'])) { $_POST['url'] = 'http://'.$_POST['url']; } 该代码先用正则表达式检查字符串中是否有"http"或"ftp"和冒号":",如果没有,在字符串前添加"http://"