比如现在有个IP地址为192.168.1.1
分成4段提取存入字符串A、b、c、d中
谁知道如何存入
分成4段提取存入字符串A、b、c、d中
谁知道如何存入
解决方案 »
- XP下VC60编写的应用程序外观,不能适应不同操作系统,比如按钮都是很丑的那种样式,怎么适应不同的操作系统?
- 做聊天软件聊天记录是存在数据库里吗
- ie置顶广告怎么实现??
- 编辑excel文件的问题
- WINAPI LogonUser到底能不能登录局域网内的其它主机呢?
- 马上给分:如果在一个对话框的中获得按键消息?
- 请问从一台机器拨号联接到一台98的机器上面应该设置什么?急
- 我对我的listctrol控件使用setbkcolor设置了背景色,可是我有数据的地方下面还是原来的颜色,我只想文字的颜色不一样,其它全是另一种颜
- 如何设置bar的停靠属性?(在线给分)
- 怎样用VC实现WINDOWS应用程序消息的捕获与回放
- 关于加载位图...
- 回帖真的是一种美德吗?
sscanf("192.168.0.1", "%d.%d.%d.%d", &a, &b, &c, &d);
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string str("192.168.1.1"); int i1 = str.find(".",0);
cout << i1 << endl;
string substring1 = str.substr(0,i1); cout << substring1 << endl;
return 0;
}
CString str = L"192.168.0.221";
int index = 0;
int i = 0;
CString a, b, c, d; while(str.GetLength() != 0)
{
i = str.Find(L".");
if (i < 0) break;
switch(index)
{
case 0:
{
a = str.Left(i);
break;
}
case 1:
{
b = str.Left(i);
break;
}
case 2:
{
c = str.Left(i);
break;
} }
str.Delete(0, i + 1);
++index;
} d = str;
CString str = L"192.168.0.221";
int index = 0;
int i = 0;
CString a, b, c, d; while(str.GetLength() != 0)
{
i = str.Find(L".");
if (i < 0) break;
switch(index)
{
case 0:
{
a = str.Left(i);
break;
}
case 1:
{
b = str.Left(i);
break;
}
case 2:
{
c = str.Left(i);
break;
} }
str.Delete(0, i + 1);
++index;
} d = str;