So I am converting the bit string to a vector of type int and then pushing the elements of vector in dynamic_bitset object and writing that object into file. Here is my code