I am using a C++ code to read some binary output from an electronic board through USB. The output is stored on an unsigned char buffer. When I'm trying to print out the value or write it to an output file, I get dummy output instead of hex and binary value, as shown here:
햻"햻"㤧햻"㤧햻"햻"㤧
This is the output file declaration:
f_out.open(outfilename, ios::out);
if (false == f_out.is_open()) {
printf("Error: Output file could not be opened.\n");
return(false);
}
This is the output command:
xem->ReadFromPipeOut(0xA3, 32, buf2);
f_out.write((char*)buf2, 32);
//f_out << buf2;
"xem" is a class for the USB communication. ReadFromPipeOut method, reads the output from the board and stores it on the buffer buf2. This is the buffer definition inside the main:
unsigned char buf2[32];