I want to convert a byte array (containing 64 elements) which looks something like this:
9b b4 f5 b0 67 3c f8 e1 f1 f8 02 8c b2 13 4d 66 f0 72 a0 05 ...
to a string. Something like "9bb4f5b067.....". Essentially I want to write this byte array into a CFile and I realized the most easy way is to convert the byte array to a string and then write the content. Whenever I try to convert the array to a string I get some special characters and when I try to write the byte array directly to the file, I see special characters written in the file. Any suggestions please?
Here is the code: pbSignature is of type PBYTE and is printed like this:
printf("The signature is: "); for (DWORD i = 0 ; i < cbSignature ; i++) { printf("%2.2x ",pbSignature[i]); } // Imprint the signature to the CRC file if (!file.Open(crcFilePath, CFile::modeWrite, NULL)) { printf("File could not be opened %d\n"); goto Cleanup; } for (DWORD i = 0 ; i < cbSignature ; i++) { //printf("size of pbsig is %d and value of pbsig is %d\n",sizeof(pbSignature[i]),pbSignature[i] ); file.Write(&pbSignature[i],sizeof(pbSignature[i])); //printf("%2.2x ",pbSignature[i]); }