This is one of the function in my C++ code, this code writes into ascii values rather than binary values. Also I have tried it on other compiler like eclipse too, the values of buf are written in ascii values. I have a hex reader which helps me to read the data from this file.
counter(okCFrontPanel *xem)
{
unsigned char buf[2048];
//long int len;
int des_done;
std::ofstream f_out (“Oct6.text”, std::ios::binary || std::ios::app );
std::ofstream file_out;
if (false == f_out.is_open()) {
printf("Error: Output file could not be opened.\n");
return(false);
} xem-> SetWireInValue(0x00, 0xffff, 0xffff);
xem -> UpdateWireIns(); // RESET
xem-> SetWireInValue(0x00, 0x0000, 0xffff);
xem-> UpdateWireIns();
xem-> ActivateTriggerIn(0x40, 0);
for(int i = 0; i < 1 ; i ++ ){
xem-> ActivateTriggerIn(0x41, 0);
printf("\nFirst time read\n");
des_done=0;
while (des_done==0) {
xem -> UpdateTriggerOuts();
des_done = xem->IsTriggered(0x60, 0x0001);
}
// Pull decrypted data out
int j;
xem -> ReadFromPipeOut(0xa1,1024, buf);
for(j =0; j,j);
f_out.write((char*)buf, 1024);
}
f_out.close();
return(true);
}
This is the ouput of my oct6 file:
@??C?Pc?p ??? C??? @p*0???*p@ ?? @p*?? ??? ??0
??? @p*?? ??? ??04Vx???? @? @p??? ??? 0???P???????????????? @p*
0???p@ ?? @p?? ??? ??0 ???? @p*?? ??? ??04Vx?*??? @? @p*???? ??? 0????
P??? @p*0???*p@ ?? @p*?? ??? ??0
??? @p*?? ??? ??04Vx???? @? @p??? ??? 0???P???????????????? @p*
0???p@ ?? @p?? ??? ??0 ???? @p*?? ??? ??04Vx?*??? @? @p*???? ??? 0????
P??? @p*0???*p@ ?? @p*?? ??? ??0
??? @p*?? ??? ??04Vx???? @? @p??? ??? 0???P???????????????? @p*
0???p@ ?? @p?? ??? ??0 ???? @p*?? ??? ??04Vx?*??? @? @p*???? ??? 0????
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 0 0 0 0 0 0 0
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? @ @ @ @ @ @ @ @ p p p p p p p p * * * * * * * * ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 4 V V V V V V V V x x x x x x x x ? ? ? ? ? ? ? ? * * * * * * * * ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? @ @ @ @ @ @ @ @ ? ? ? ? ? ? ? ? @ @ @ @ @ @ @ @ p p p p p p p p * * * * * * * * ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 0 0 0 0 0 0 0 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
I would be grateful for your kind feedback.
Thanks!