LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   STL bit_vector to a binary file (https://www.linuxquestions.org/questions/programming-9/stl-bit_vector-to-a-binary-file-415926/)

crapodino 02-15-2006 09:19 PM

STL bit_vector to a binary file
 
This is simple. HOW CAN I STORE A BIT_VECTOR ( from STL ) INTO A BINARY FILE ?? NOT the pointers of bit_vector. Of course, i want to be able to read the file and have again my bit_vector just as the original. For example: bit_vector x(500)

If someone really knows, please tell me. If it isn't possible i'll have to use an auxiliary array, isn't it ?

i really need to do this

thanks

spooon 02-15-2006 10:47 PM

Just take every eight bits, put them together into a byte, and then write the byte. There's nothing special about a bit vector from other types of vectors (how would you "store" other types of vectors?).


All times are GMT -5. The time now is 01:09 PM.