Chinaunix首页 | 论坛 | 博客
  • 博客访问: 38826
  • 博文数量: 10
  • 博客积分: 456
  • 博客等级: 下士
  • 技术积分: 110
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-06 15:19
文章分类

全部博文(10)

文章存档

2020年(1)

2013年(1)

2009年(2)

2008年(6)

我的朋友
最近访客

分类: C/C++

2008-08-31 08:42:58

// VS6 2008/8/30

#include
#include
#include
using namespace std;

struct data{
    unsigned type    :    2 ;
    unsigned d        :    1 ;
    unsigned context:    5 ;
};

// ofstream 对象不能复制,只能引用传参
void fprint(ofstream &file,struct data t)
{
    int temp = (t.type<<6) + (t.d<<5) + t.context;
    if (temp<16)
    {
        file<    }
    file<}

int main(void)
{
    int j;
    ofstream fsOut("TestData.dat");
    
    for(j=0;j<16;j++)
    {
        int j1=(j&8)&&1,j2=(j&4)&&1,j3=(j&2)&&1,j4=j&&1;
        fsOut<    }

    struct data t;
    t.type = 2;
    t.d = 0;
    t.context = 0x12;
    fprint(fsOut,t);
    fsOut.close();
    cout<    return 0;
}

 
阅读(1122) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:减小vc编译文件体积

给主人留下些什么吧!~~