HexStrToBits
convert a hex string to a vector of 1's and 0's
bool HexStrToBits( const string & strHex, vector<byte> & vn )
true if succeed
EX1
void BitsHex_HexStrToBits_ex1() { string strHex = "E38C"; vector<byte> vb; BitsHex bh; if ( bh.HexStrToBits(strHex, vb) ) { printf("Hex string %s is convert to vector as follows:\n", strHex); int nTotal = vb.GetSize(); printf("vector {%d, ", vb[0]); for ( int ii = 1; ii < nTotal - 1; ii++ ) printf("%d, ", vb[ii]); printf("%d}\n", vb[ii]); } else printf("Fail to convert Hex string %s to byte vector.\n", strHex); }
BitsHex::BitsToHexStr
origin.h