#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<
}