Hi,
I have a C++ Dll that reads from a string.
i_ch = szRecord[ z_ct++ ];
pd.Demo= i_ch & 0x0F;
pd.Demo1 = (i_ch>>4) & 0x0F;
i_ch = szRecord[ z_ct++ ];
pd.Demo2 = i_ch & 0x1F;
pd.Demo3 = (i_ch>>5) & 0x03;
pd.Demo4 = (i_ch>>7) & 0x01;
i_ch = szRecord[ z_ct++ ];
pd.Demo5 = i_ch & 0x07;
pd.Demo6 = (i_ch>>4) & 0x0F;
szRecord is the string containing the data.
pd is a type.
I don't understand the following:
i_ch = szRecord[z_ct++] - I think it takes byte at a time, not sure though
pd.Demo = i_ch & 0x00F - no clue
pd.Demo3 = (i_ch>>5) & 0x03 - what does the i_ch>>5 mean and what does the & 0x003 in all the lines mean?
Thanks,




Reply With Quote