Is it possible to shift bits like in c from VB? Is it also posible to use bitwise logical operators?
The reason that I am asking is that I have to store the various types of attributes that a file can have (ie read-only, archive, hidden etc.) in a database. I would prefer not to have to create a seperate field for each of the attributes.
Basically what I want to do is store a binary number like 1011 in the field representing which attributes are turned on and which are not.
Say I want to figure out if the third bit is on (third from the right ie from the least significant bit).
temp1 = 1011
temp2 = 100 'ie 1 shifted to the left 3 places
result = temp1 and temp2
result will yeild 0000 which indicates that the bit is off.
Would this be the best approach or is there a better way?
Thanks in advance
Troy Williams B.Eng.
fenris@hotmail.com
The reason that I am asking is that I have to store the various types of attributes that a file can have (ie read-only, archive, hidden etc.) in a database. I would prefer not to have to create a seperate field for each of the attributes.
Basically what I want to do is store a binary number like 1011 in the field representing which attributes are turned on and which are not.
Say I want to figure out if the third bit is on (third from the right ie from the least significant bit).
temp1 = 1011
temp2 = 100 'ie 1 shifted to the left 3 places
result = temp1 and temp2
result will yeild 0000 which indicates that the bit is off.
Would this be the best approach or is there a better way?
Thanks in advance
Troy Williams B.Eng.
fenris@hotmail.com