How to check if a certain bit in a byte is set?
bool IsBitSet(Byte b,byte nPos)
{
return .....;
}
sounds a bit like homework, but:
bool IsBitSet(byte b, int pos)
{
return (b & (1 << pos)) != 0;
}
pos 0 is least significant bit, pos 7 is most.