So I have to code the following function for a file-page-manager program, but I don't understand how to handle the null terminating feature.
RC insertRecord(FileHandle &fileHandle, const vector<Attribute>
&recordDescriptor, const void *data, RID &rid)
Given a record descriptor, insert a new record into the file identified by the provided handle. You can assume that the input is always correct and free of error. That is, you do not need to check to see if the input record has the right number of attributes or if the attribute types match. However, in order to deal with NULL values in the attributes, the first part in *data contains n bytes for passing the null information about each fields. The value n can be calculated by using this formula: ceil(number of fields in a record / 8). For example, if there are 5 fields, ceil(5/8) = 1 byte. If there are 20 fields, the size will be ceil(20/8) = 3 bytes. The left-most bit in the first byte corresponds to the first field. The right-most bit in the first byte corresponds to the eighth field. If there are more than eight fields, the left-most bit in the second byte corresponds to the ninth field and so on. If the corresponding bit to each field is set to 1, then the actual data does not contain any value for this field. For example, if there are three fields in a record and the second field contains NULL, the bit representation in a byte is 0100000. In addition, in the actual data, the incoming record contains the first and the third values only. That is, the third field value is placed right after the first field value in this case.
I don't understand, so if we have 3 attributes then 3/8=3 bytes, so the first 3 bytes of data will correspond to the null feature; however, how do we convert these bytes to bits in c++, so we can actually see where the null values are?