Write your question here.
I need help taking the result from a bitset and move it into a array
what i do is
|
fwrite(&binn1, 4, 1, fh2);
|
this write it to a file that I use in a assembly application.
What do i have to do to move it to a array?
The full code is
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
strcpy_s(drive1, drive);
strcat_s(drive1, "\\PATTERNLIST.AMI");
FILE *fh2 = fopen(drive1, "ab"); // binary write
c = 1;
while (c < fp + 1)
{
sprintf_s(name, "fp%i", c);
AmiVar todaya = gSite.GetVariable(name);
c1 = 0;
c2 = 0;
binn1.reset();
while (c1 < 16)
{
c1a = int(todaya.array[c4 - c1]);
if (c1a != 0 && c1a != 1)
{
//strcat(binn, "11");
binn1.set(c2);
binn1.set(c2 +1);
c2 += 2;
}
else
{
if (c1a == 1)
{
//strcat(binn, "01");
binn1.reset(c2);
binn1.set(c2+1 );
c2 += 2;
}
else
{
//strcat(binn, "10");
binn1.set(c2);
binn1.reset(c2 + 1);
c2 += 2;
}
}
c1++;
}
fwrite(&binn1, 4, 1, fh2);
binn1.reset();
c++;
}
fclose(fh2);
}
c4++;
|
seem like I might have made a mistake with that fwrite. I use a & binn1 in it.
It seems to write all all 32bits as 1 int. I am not sure it doing that.
I have 2 dll the one above is working
i cannot do fwrite with out a error
it the same code. it declare the same way
the second dll with the same routine wont let me fwrite it give me error
Error (active) E0109 expression preceding parentheses of apparent call must have (pointer-to-) function type
/code
std::bitset<32> binn1(31);
[/code]
also i notice in the debugger a raw view. that should be the number i write and read back
basically it all the single bits tied to a 32 bit.
which i think it doing when i do the write.
I do the routine again i need that number to be a int to put into the array.
the problem is wrong numbers.