Chinaunix首页 | 论坛 | 博客
  • 博客访问: 227498
  • 博文数量: 66
  • 博客积分: 2510
  • 博客等级: 少校
  • 技术积分: 700
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-27 22:10
个人简介

闲时会写写程序的非技术人员。

文章分类

全部博文(66)

文章存档

2022年(1)

2018年(11)

2011年(1)

2010年(36)

2009年(17)

我的朋友

分类: C/C++

2010-07-28 14:02:12

还是用到了万恶的strtok

#include
#include
#include
#include
#include
#include
#include

using namespace std;

int main()
{
    ifstream f("x.cfg");

    string str;
    while(getline(f,str))
    {
        if(str[0]=='[')
            cout<        else
        {
            const char* needle="=";
            char* ccc=const_cast(str.c_str());   
           
            char* c=strtok(ccc, needle);

            if(c)
                cout<<"F:"<            c = strtok(NULL, needle);
            if(c)
                cout<<"R:"<        }
       

    }

    return 0;
}


阅读(957) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~